This is a legacy guide for Power Manager v4, published 2010 – 2019, and is provided for reference only.
The latest guide is for Power Manager v5.10.6.

Working With Other Scheduling Tools

Power Manager has been designed to work well with other tools. Where Power Manager reaches the limits of its functionality, we ensured the engine offered a well-defined and documented interface. Through these interfaces the engine can talk to, and listen to, other tools.

We want Power Manager to be a great general purpose scheduling tool. However, we appreciate that other tools can and should be used alongside Power Manager when creating your energy saving schedules.

A couple of beloved tools come to mind: launchd and cron.

launchd

launchd (Launch Daemon) is a core low level component of Mac OS. launchd is open source and managed by Apple, Inc. launchd is often used as a scheduling tool by administrators.

The design principal behind launchd differs from Power Manager. launchd is designed as a watchdog tool for host, user, and session wide services. launchd’s primary concern is ensuring critical services are available as needed. No attempt is made to be a user level tool.

To consider Power Manager a replacement, or alternative, to launchd risks missing the vital role launchd plays in the Mac OS. Power Manager itself is launched and watched over by launchd.

Power Manager adds a layer above launchd; a layer where the user’s schedule is the primary concern.

Triggering an Event from a launchd Job Ticket

To trigger a Power Manager event from a launchd job ticket, use the pmctl tool. Within your launchd job ticket, call pmctl with the request scheduler.perform, and provide the desired event identifier as the parameter.

Example 1.12. launchd job ticket to trigger a Power Manager event

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>com.example.launchd</string>
    <key>ProgramArguments</key>
    <array>
        <string>/Applications/Power Manager.app/Contents/Tools/pmctl</string>
        <string>ondemand.perform</string>
        <string>unique ID=an-event-id</string>
    </array>
    ...

launchd job ticket to perform a Power Manager event.

cron

cron is a stalwart of the UNIX scheduling world. cron is a fairly simple but impressively powerful tool for running commands.

Commands can be set to run when a specific time occurs. cron’s interface and design suits an always on, terminal driven, computing environment from a previous era of UNIX. With modern UNIX variants came graphical interfaces, increased security boundaries, and abstractions freeing the user from needing a terminal.

Despite this move away from the terminal, cron remains popular. It is reliable and the notation cron uses for encoding repeating trigger time instructions is surpassed in expressive power by few other tools.

However, cron has weaknesses. cron makes assumptions that are no longer true: the host computer is always on and CPU instructions are cheap.

cron’s scheduler requires processing time each and every minute. Each minute the scheduler checks if a command needs to be run. This simple looping behaviour permits the tool’s complex notation and provides a reliable service.

The need to process the schedule every minute is no longer appropriate. What if the host is powered off, or asleep? If the next scheduled event is six months away, why burden the processor every minute until that time?

launchd was created, in part, to replace cron and similar tools. However, there are still situations where cron is needed, or preferred. For those situations, you can use cron to trigger your Power Manager events.

Triggering an Event from a cron Job

To trigger a Power Manager event from a cron job, use the pmctl tool. Set the cron job command to call pmctl with the request ondemand.perform, and provide the desired event identifier as the parameter.

Example 1.13. cron job to trigger a Power Manager event

*/15 9-17 * * * root '/Applications/Power Manager.app/Contents/Tools/pmctl' ondemand.perform 'unique ID=your-event-id'

cron job to perform a Power Manager event every 15 minutes between 9am - 5pm.