better crontab in leopard with launchctl and launchd

Using the crontab is great, but there are other tools out there on Leopard that do something similar to crontab and on Leopard, its called launchd.

To create a new entry, make a new file in ~/Library/LaunchAgents/net.laptop.getmail.plist with the content of:

<?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>net.laptop.getmail</string>
<key>UserName</key>
<string>aaron</string>
<key>ProgramArguments</key>
<array>
<string>/Users/your_user_name/bin/script.sh</string>
</array>
<key>StartInterval</key>
<integer>30</integer>
</dict>
</plist>

then execute:

launchctl load ~/Library/LaunchAgents/net.laptop.getmail.plist

Leave a Reply

You must be logged in to post a comment.