Deploying Remote Schedules
Welcome to Power Manager. In this article I will show you how to use Power Manager from the command line. I will then discuss how to deploy new schedules over a network.
Installing a new schedule on a remote computer
This article assumes a basic level of familiarity with the command line and Terminal on Mac OS X. If the command line is new to you, don't panic as all the steps are provided.
For the rest of this article I will refer to two computers: a local computer, and a remote computer. Both computers must have Power Manager installed.
The remote computer must have Remote Login enabled.
Overview
This tutorial can be reduced to the following set of commands.
/usr/local/powermanager/bin/powermanagerctl scheduler.events > ~/Desktop/schedule.plist scp ~/Desktop/schedule.plist admin@192.168.90.1:/tmp/. ssh admin@192.168.90.1 /usr/local/powermanager/bin/powermanagerctl scheduler.setevents ~/Desktop/schedule.plist exit
Create a Schedule
We need a schedule to deploy on the client computer. The schedule is an XML Property List file (.plist) and can be created manually, by a script, or with the help of Power Manager's System Preference.
For this tutorial I am going to use the System Preference, but it is worthwhile taking a look at the schedule file generated. It is human readable and can be edited with a text editor.
Create your desired schedule using the System Preferences.
Create your schedule locally
Pipe the Schedule to a File
With the new schedule created in the System Preferences, you pipe the schedule's events to an XML property list file.
/usr/local/powermanager/bin/powermanagerctl scheduler.events > ~/Desktop/schedule.plist
Copy the File to the Remote Computer
We need to get our schedule onto the remote computer. There are numerous ways of doing this and I will discuss alternatives in a moment.
To copy our schedule we are going to use the secure copy command (scp) to copy the file across the network.
In the Terminal modify and enter the following command:scp -v ~/Desktop/schedule.plist admin@192.168.90.1:/tmp/.
You must modify two parts of the previous secure copy command.
admin= An administrator's username on the remote computer.192.168.90.1= The remote computer's hostname or IP address.
If all goes well, you will be asked for the remote user's password before the copy occurs.
Connect and Set the Schedule
We have created a new schedule locally, copied it securely across the network, and are now ready to install it.
We need to tell the remote copy of Power Manager to use our new schedule.
In the Terminal modify and enter the following commands:
ssh admin@192.168.90.1 /usr/local/powermanager/bin/powermanagerctl schedule.setevents /tmp/schedule.plist exit
You must modify two parts of the previous secure shell command.
admin= An administrator's username on the remote computer.192.168.90.1= The remote computer's hostname or IP address.
Congratulations!
You have just installed a schedule on a remote computer.
Deploying schedules on a large network
This article walked you through the steps involved in distributing a schedule onto a single remote computer.
What if you have a network of tens or hundreds of Macs?
You can maintain a distributed schedule in many ways. One option is to use launchd to watch a schedule file. If the schedule file changes, call the schedule.setevents command.
Alternatively you can host a schedule on a server and use a launchd/cron job to fetch and install the schedule as needed.