Reputation: 575
Like it says on the tin, I've a launch script that is supposed to fire at 1.20 AM but seems to be firing shortly after the user logs in instead. Can anyone see what I've done wrong?
Is is the way I've written the ProgramArguments, reaching within the app's container to launch it? I've not had success launching the (applescript) app any other way i.e. open ~/Library/CDesResources/Shutdown.app
didn't seem to work.
The plist is saved in ~/Library/LaunchAgents/shutdownAgent.plist
so it should only fire when that user is logged in correct?
Many thanks for your fresh eyes and expertise.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>shutdownAget</string>
<key>Nice</key>
<integer>-20</integer>
<key>ProgramArguments</key>
<array>
<string>/Library/CDesResources/Shutdown.app/Contents/MacOS/applet</string>
</array>
<key>RunAtLoad</key>
<false/>
<key>ServiceDescription</key>
<string>launch the shutdown script</string>
<key>StartCalendarInterval</key>
<dict>
<key>Hour</key>
<integer>1</integer>
<key>Minute</key>
<integer>20</integer>
</dict>
</dict>
</plist>
Upvotes: 1
Views: 289
Reputation:
From the man page for launchd.plist(5)
:
Unlike cron which skips job invocations when the computer is asleep, launchd will start the job the next time the computer wakes up. If multiple intervals transpire before the computer is woken, those events will be coalesced into one event upon wake from sleep.
So launchd
is correctly noticing at launch that the job didn't run at 01:20 and scheduling it for you.
Upvotes: 1