unix - How to schedule a script which executes daily? [OSX] -
i have python script want run daily @ let's 9 am. if system not on @ time, script should run computer gets turned on again.
i'm looking anacron
.
how can achieve this? cron job doesn't fulfill purpose.
create launch daemon file, set ownership root:wheel , permissions 644, , place in /library/launchdaemons. @ minimum, file should contain this:
<?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>local.maintenance</string> <key>programarguments</key> <array> <string>/path/to/your/script</string> </array> <key>startcalendarinterval</key> <dict> <key>hour</key> <integer>9</integer> <key>minute</key> <integer>0</integer> </dict> </dict> </plist>
note although missed run of daemon made @ next opportunity, it'll "coalesce" multiple missed runs. example, if computer off 5 days, daemon run once when starts up.
Comments
Post a Comment