28th
OSX: How To Change When Periodic Scripts Are Run
Suppose you want to run a backup job every day. You place a script in /etc/periodic/daily/ that runs the backup, test it, everything works. But when will it be run?
The default answer is 3:15 am. But what if your Mac is set to sleep every night at 11:00 pm? You need to tell your Mac to run the daily scripts at, say, 9:15 pm instead. But how?
The simple answer is, you need to edit /System/Library/LaunchDaemons/com.apple.periodic-daily.plist and change the StartCalendarInterval’s Hour value (launchd.plist man page).
To edit the plist as an admin, you need to use Terminal.app:
sudo '/Developer/Applications/Utilities/Property List Editor.app/Contents/MacOS/Property List Editor' '/System/Library/LaunchDaemons/com.apple.periodic-daily.plist' Sorry, but I wasn’t able to find a cleaner way to do it. sudo open -a ‘Property List Editor’ doesn’t run the editor as an admin, despite what you might hope.
Anway, once you change the plist, use your still-open Terminal to re-load the configuration:
sudo launchctl unload /System/Library/LaunchDaemons/com.apple.periodic-daily.plist
sudo launchctl load /System/Library/LaunchDaemons/com.apple.periodic-daily.plist
Look for your script (and other daily scripts) to run at the configured time.
Note: Apple’s relatively new launchctl/launchd system has led to much confusion on teh interwebs about how periodic scripts can be controlled in OSX. Use of crontab to do these things is not recommended any more (and IIRC won’t work), so (as always) be careful about the age of any advice you get on the net.