I set up a launchd plist to run a shell script every morning at 8 AM
(see Is there an easy way to automatically schedule a move of files matching a certain pattern from a user directory to a USB drive? for context).
Yesterday, I created the plist, put it in /Library/LaunchDaemons, and did a did a launchctl load /Library/LaunchDaemons/sweep.plist
(either sudo'd or in a sudo bash) once it was in place.
BUT IT DIDN'T WORK! It's called "sweep.plist," and it is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>sweep</string>
<key>Program</key>
<string>/Users/europa/sweep.sh</string>
<key>StartCalendarInterval</key>
<dict>
<key>Hour</key>
<integer>8</integer>
<key>Minute</key>
<integer>0</integer>
</dict>
</dict>
</plist>
I'm absolutely certain that after I did the launchctl load
yesterday, "sweep" showed up in a launchctl list
, but my shell script didn't execute, and the daemon no longer shows up when I do a launchctl list
.
New: I checked the system log, and sure enough, there was an error message. Not sure what to do about it:
May 10 08:00:05 Europas-Mac-mini com.apple.xpc.launchd[1] (sweep[1299]): Program specified by service is not a Mach-O executable file.
Looking at the shell script with a ls -l
, it shows permissions as -rwxr-xr-x@
Any idea what I could have done wrong, or where to look for the problem?