-Techniques and tricks‎ > ‎Mac OS X‎ > ‎

Scheduling recurring jobs

How to make and restart the daemons that perform jobs on a schedule:

Example:

sudo launchctl load /Library/LaunchDaemons/<daemon name>.plist

That is

sudo launchctl load /Library/LaunchDaemons/data1_update.plist
sudo launchctl load /Library/LaunchDaemons/data2_update.plist
sudo launchctl load /Library/LaunchDaemons/data3_update.plist

An example file that updates the file permissions of a drive every 3600 seconds (that is, runs /bin/chmod -R 775 /Volumes/DataDrive/Data1) is: data1_update.plist

<?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>Label</key>
    <string>com.apple.kfc-data1.plist</string>
    <key>ProgramArguments</key>
    <array>
        <string>/bin/chmod</string>
<string>-R</string>
<string>775</string>
        <string>/Volumes/DataDrive1/Data1</string>
    </array>
    <key>StartInterval</key>
    <integer>3600</integer>
</dict>
</plist>
Comments