I'm trying to schedule a simple task in OS X Mountain Lion 10.8.3
launchctl start nextstopsun.helloworld
command doesn't execute the script and throws a message to a console
4/2/13 9:50:49.663 PM com.apple.launchd.peruser.501[139]: (nextstopsun.helloworld[46729]) Job failed to exec(3) for weird reason: 8
My plist is very simple:
<?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>nextstopsun.helloworld</string>
<key>Program</key>
<string>/Users/nextstopsun/Work/scripts/hw.sh</string>
<key>StartCalendarInterval</key>
<dict>
<key>Hour</key>
<integer>21</integer>
<key>Minute</key>
<integer>15</integer>
</dict>
<key>UserName</key>
<string>nextstopsun</string>
</dict>
</plist>
The script is also very simple
echo "Hello World!" > hw.log
launchctl loaded it with no errors. When executing script from shell it works as expected. Logging off and logging back in doesn't help. Didn't find any answer in Google. Whats that "weird reason: 8" all about?
Few suggestions:
chmod +x <your_script>
) or launch it via bash or sh passing script as parameter#!/bin/sh
or #!/bin/bash
. Note that it must be the first line in script.launchctl load <your_plist>
. But I think you've already done this or there will be other error message.