Hello,
I have a question regarding how launchd handles tasks that are scheduled to start -- using StartCalendarInterval -- at a point in time where your computer is shutdown.
The documentation launchd.plist(5) clearly states:
"Unlike cron which skips job invocations when the computer is asleep, launchd will start the job the next time the computer wakes up."
Below is an example launchd job that executes when started manually.
It fails to execute if the computer was shut down (power off) at 22:00 and awakened at 06:00 the next morning.
The job is not disabled locally or globally.
plutil -p ~/Library/LaunchAgents/local.XX.plist
{
"Program" => "/usr/local/bin/fab"
"StandardOutPath" => "/var/log/XX.log"
"ProcessType" => "Background"
"StartCalendarInterval" => {
"Minute" => 0
"Hour" => 0
}
"ProgramArguments" => [
0 => "fab"
1 => "backup:dbname=XX"
]
"StandardErrorPath" => "/var/log/XX.log"
"WorkingDirectory" => "/Users/XX/XX-backup"
"Label" => "local.XX"
}1) Can I safely assume that shutdown is equivalent to asleep in the context of launchd?
2) Are there any known bugs associated with the StartCalendarInterval key?
3) Is my understanding correct that if a job is scheduled to start while the computer is shutdown, then the job will start when the computer becomes awake?
4) Given that the above example job executes normally when started manually, what might be preventing the job from starting in the morning (after returning from a shutdown state)?
Thank you for your time