1

I have a daemon/script that runs daily in macos Sierra, but I can't find a way to make it run if the computer was off at the scheduled time. Specifically, I'd like:

  • run script/daemon once a day at a X:00 am
  • if computer is off/sleeping at X:00, runs immediately when it wakes
  • if daemon misses scheduled runs (off for several days), it runs once immediately when it wakes

The first point is handled easily with:

<key>StartCalendarInterval</key>
        <dict>
            <key>Hour</key>
            <integer>10</integer>
        </dict>

Running on startup/login when the scheduled time is "missed" is not the (default) behavior of launch agents, despite the suggestion (and later correction) in this question:

https://superuser.com/questions/126907/how-can-i-get-a-script-to-run-every-day-on-mac-os-x

  • Which OS are you talking about? MacOS X? Please add this info to title because in modern Linux you handle it with systemd.timer – user996142 Jun 27 '17 at 20:01
  • @user996142 osx. will edit. – anon01 Jun 27 '17 at 20:09
  • have you tried adding passing your script to the anacron daemon? Anacron is 'anachronistic' and is designed for systems that are not running 24x7. – Gothburz Jun 27 '17 at 22:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.