Weblog | Techlog | MySpace

MacOSX: March 2008Archive

On MacOSX 10.4.x or greater version, you can not use cron daemon to execute scheduled commands.
You have to use launchd.

Add plist under /System/Library/LaunchDaemons.

First string belongs to the key "Label" is unique ID of Daemon process.

The array of "Program Arguments" is the command you want to execute.

And "StartCalendarInterval" is date and time of the scheduled command.

After setting plist, enter the command to load plist.

# launchctl load -w NAMEOFPLIST

And check if the plist was surely loaded,

# launchctl list

Unload plist,

#launcctl unload -w NAMEOFPLIST


Here is a sample plist.
----------------------------------------------------

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>named0309</string>
<key>LowPriorityIO</key>
<true/>
<key>Nice</key>
<integer>1</integer>
<key>ProgramArguments</key>
<array>
<string>/Users/Applications/YOURCOMMAND</string>
</array>
<key>StartCalendarInterval</key>
<dict>
<key>Minute</key>
<integer>37</integer>
<key>Hour</key>
<integer>14</integer>
<key>Day</key>
<integer>12</integer>
<key>Month</key>
<integer>4</integer>
</dict>
</dict>
</plist>

About this archive

This page contains in category of MacOSX from March 2008

Recent entries are in

Index Page.

Past entries are in

Archive page

MacOSX: March 2008: Monthly Archive

RSS RSS