How to Prepare a Schedule for File Configuration

Learn how to export and prepare a schedule for distribution using Power Manager's file configuration capability.

Power Manager can be managed using a technique called file configuration. File configuration involves placing a file of settings and commands in a secure folder for Power Manager to read. In this recipe we use the new -file-configuration flag added to pmctl. This flag eases the creation of the configuration file.

This recipe uses the pmctl tool included with Power Manager. pmctl is available for Mac, Linux, and Windows. This recipe assumes pmctl is running on a Mac with Power Manager’s scheduler installed.

On macOS, the pmctl tool is stored in /Applications/Power Manager.app/Contents/Tools. To use the tool, launch Terminal.app and change to the tool’s folder:

cd '/Applications/Power Manager.app/Contents/Tools'

You can query the installed version of pmctl using the command:

./pmctl -version

There are two steps to preparing a schedule for distribution via file configuration:

  • Export the schedule to a file;
  • Encode the schedule file for deployment via file configuration.

Export the Schedule

To export the schedule, use the following command:

./pmctl eventstore.events > /tmp/pm-schedule.plist

This command ask Power Manager’s event store to output all known events. The command pipes this output to a temporary file called pm-schedule.plist. By default, the output is formatted as a Property List (plist) file.

Encode the Schedule

To encode the schedule for use with file configuration, use the following command:

./pmctl -file-configuration ~/Desktop/pmd.plist eventstore.store 'events=(plist:file:///tmp/pm-schedule.plist)'

This command uses the -file-configuration flag introduced with Power Manager v5.6.1. The flag encodes the requests into a file configuration suitable format.

The command’s -file-configuration flag is passed the output file name pmd.plist; this file is created by the command and will contain our encoded request.

The trailing eventstore.store request and events parameter ask Power Manager to store the given set of events. It is this request that will be encoded and written to the pmd.plist file.

Replacing the Schedule

By default, the eventstore.store request merges the existing schedule with the incoming events. To replace the existing schedule, add the optional replace existing parameter:

./pmctl -file-configuration ~/Desktop/pmd.plist eventstore.store 'events=(plist:file:///tmp/pm-schedule.plist)' 'replace existing:boolean=true'

Ready to Deploy

The newly created file ~/Desktop/pmd.list is now ready to deploy with file configuration.