How to Set Up Power Manager with a Web Server
Power Manager's energy saving schedules can be deployed through a web server. This technique can be used to deploy schedules to a few Macs or many thousands of Macs.
Power Manager’s energy saving schedules can be deployed through a web server. This technique can be used to deploy schedules to a few Macs or many thousands of Macs.
There are two parts to setting up schedule deployment via a web server. You need a web server and you need shell access to the Macs to update. This probably means an Apache httpd or nginx web server, and a mass ssh tool such as Apple Remote Desktop (ARD).
Create the Schedule
The schedule needs to be created in Power Manager and then exported. You can create a schedule of any complexity for deployment.
Launch Power Manager.
Create a schedule of events to deploy.
Export the schedule using the Export Schedule… menu item:
Power Manager > File > Export Schedule…
An exported Power Manager schedule can be deployed via http.
Move the exported schedule file into your web server’s realm.
Test that you can reach the schedule file using a web browser. The exported file should be treated as a binary file by your web server.
With the schedule available at a known URL. You can next tell your Macs running Power Manager to fetch and apply the schedule.
Pull the Schedule
Each Mac needs to run the following command:
"/Library/Application Support/Power Manager/Tools/pmctl" -r eventstore.store -p "replace existing=yes" -p "events=(plist:https://example.dssw.co.uk/schedule.pm-schedule)"
This command tells Power Manager to apply the schedule fetched from a URL. You will need to change the URL to point to your web server; otherwise no other changes are needed.
The command used the command line tool
pmctl. This tool is included with Power Manager.
pmctl can be used to access and interact with Power Manager running both locally and on remote Macs. In this case we are using
pmctl to issue the command
eventstore.store with two parameters.
The first parameter, replace existing, tells Power Manager to remove existing events before storing the incoming events.
The second parameter, events, provides Power Manager with events to store.
In the snippet above, I have used the
https:// protocol to pull the schedule from a web server. You can use
file:// to locate your schedule.
Use your preferred mass ssh tool to issue the
pmctl command on your Macs. You could embed and automate schedule updates by embedding the command within a Power Manager event, cron job, or launchd job ticket.