launchd
This page describes how the Mac daemon 'launchd' is used to automatically run the nightly build on the Leopard Intel Mac platforms.
In the past, a standard 'cron' job was used to run the nightly build script (as is done on the Linux build platforms), but beginning with the Leopard release, cron no longer seems to work. Apple strongly recommends using their 'launchd' daemon to run stuff like this, so be it.
launchd needs a plist file to describe the task. Here are the contents of a file named 'DevNightlyBuild.plist', created using the utility Launchd Editor (but a text editor will suffice):
<?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>GroupName</key> <string>fsdev</string> <key>Label</key> <string>DevNightlyBuild</string> <key>Program</key> <string>/space/freesurfer/build/scripts/build_dev.csh</string> <key>ProgramArguments</key> <array> <string>&</string> </array> <key>ServiceDescription</key> <string>nightly build of dev enviro</string> <key>StartCalendarInterval</key> <dict> <key>Hour</key> <integer>4</integer> <key>Minute</key> <integer>0</integer> </dict> <key>UserName</key> <string>nicks</string> </dict> </plist>
This should execute the script /space/freesurfer/build/scripts/build_dev.csh at 4:00AM each day.
This file is stored in the directory $HOME/Library/LaunchAgents.
To activate it, run launchctl:
launchctl launchd%
which brings up the launchd prompt. Type 'help' to show commands. To load the plist, type:
launchd% load /homes/11/nicks/Library/LaunchAgents/fs.DevNightlyBuild.plist
replacing of course the proper path to your plist file. If you type 'list', you should see 'DevNightlyBuild' in the list.
The script should run a 4:00AM. Check /var/log/system.log for errors.
Note! Be sure to delete any backup or junk files in your ~/Library/LaunchAgents/ directory, as launchctl seems to try to read any file in that directory (as found by examining /var/log/system.log).
Testing the launchd immediately
Let's suppose the file is named fs.DevNightlyBuild.plist in ~/Library/LaunchAgents/
To load the file,
launchctl load -w /Users/krish/Library/LaunchAgents/fs.DevNightlyBuild.plist
To test it immediately,
launchctl start DevNightlyBuild
Note that the argument to start is the Label given in the above .plist file.
To stop / unload ( both are different )
launchctl unload -w /Users/krish/Library/LaunchAgents/fs.DevNightlyBuild.plist