Is launchd supposed to pick up "missed" events?
It's limited to jobs that were scheduled during sleep (not when shut down) and by a StartCalendarInterval parameter (not StartInterval).
Daemons and Services Programming Guide: Scheduling Timed Jobs
If you schedule a
launchd
job by setting theStartCalendarInterval
key and the computer is asleep when the job should have run, your job will run when the computer wakes up. However, if the machine is off when the job should have run, the job does not execute until the next designated time occurs.All other
launchd
jobs are skipped when the computer is turned off or asleep; they will not run until the next designated time occurs.
It might be that the event fails because it is run before Internet connectivity is fully established.
Here is some info from the article Schedule jobs using launchd :
If your computer sleeps often, it will be asleep when jobs should run, which means it will run them right when it wakes up, possibly before it connects to the internet. I have experimented with KeepAlive and NetworkState to get a job to repeat itself until there is a network connection. You could also use SuccessfulExit write the script so that it only returns a nonzero code to mean “run again in 10 seconds.” Either method would have the script running (and presumably failing) every 10 seconds when you have no internet connection. A better idea would be to just sleep 5 seconds at the beginning of your script. Or you could double the run frequency and hope for the best.