[launchd-dev] launchd StartInterval and sleep

Todd Heberlein todd_heberlein at mac.com
Mon Oct 29 13:57:23 PDT 2012


What is the expected behavior when using StartInterval to start a script every n seconds and then the machine goes to sleep?


The reason I ask is that I had a StartInterval of 4 hours (14400 seconds), put my laptop to sleep overnight, and when I opened it, I expected the script to automatically execute because the interval expired during the sleep.

But this didn't happen.

Now experimenting with just a 5 minute interval, it seems that if the interval would be reached when the machine is asleep (1) the script doesn't fire when the machine wakes back up, and (2) the start interval starts again using the new wakeup time. For example, the next time the script fires is 5 minutes after wakeup.

Is this the way it is supposed to work, or am I doing something wrong?

Thanks,

Todd



More information about the launchd-dev mailing list