launchd as cron crash course
- 1 minutes read - 86 wordsinsert
<?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.whatever.five_after</string>
<key>ProgramArguments</key>
<array>
<string>echo just ran > /tmp/whatever_five_after</string>
</array>
<key>StartCalendarInterval</key>
<dict>
<key>Minute</key><integer>5</integer>
</dict>
</dict>
</plist>
into $HOME/Library/LaunchAgents/com.whatever.five_after.plist
If you call a script in the ProgramArguments section, remember to make it executable and define the script properly.
Run
launchctl load $HOME/Library/LaunchAgents/com.whatever.five_after.plist
launchctl start com.whatever.five_after
Can also run every N seconds with
<key>StartInterval</key><integer>N</integer>
Can also check the status with
launchctl list | grep com.whatever
and check for status (the second column) = 0.