[launchd-dev] launchd StartInterval and sleep

Matthew Morris mmorris at bomgar.com
Mon Oct 29 14:07:06 PDT 2012


This could be a bug in launchd. For the example you gave, the man pages indicate that you should see exactly one execution when the machine wakes up.

quote from the launchd.plist man pages:
StartInterval <integer>
     This optional key causes the job to be started every N seconds.  If the system is asleep,
     the job will be started the next time the computer wakes up.  If multiple intervals tran-
     spire before the computer is woken, those events will be coalesced into one event upon
     wake from sleep.


Matthew Morris
Sr. Software Developer

601.607.8265 O
601.510.9080 F

BOMGAR | Enterprise Remote Support&#8482;

One of the Fastest-Growing Software Companies in America | Inc. 500
________________________________________
From: launchd-dev-bounces at lists.macosforge.org [launchd-dev-bounces at lists.macosforge.org] on behalf of Todd Heberlein [todd_heberlein at mac.com]
Sent: Monday, October 29, 2012 3:57 PM
To: launchd-dev at lists.macosforge.org
Subject: [launchd-dev] launchd StartInterval and sleep

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

_______________________________________________
launchd-dev mailing list
launchd-dev at lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo/launchd-dev


More information about the launchd-dev mailing list