---- = 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): {{{ GroupName fsdev Label DevNightlyBuild Program /space/freesurfer/build/scripts/build_dev.csh ProgramArguments & ServiceDescription nightly build of dev enviro StartCalendarInterval Hour 4 Minute 0 UserName nicks }}} 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 }}}