2
我試圖安排在OS X山一個簡單的任務獅子10.8.3的launchd作業未能執行exec(3)奇怪的原因:8
launchctl start nextstopsun.helloworld
命令不執行腳本並拋出一個消息控制檯
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
我的plist很簡單:
<?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>
劇本也很簡單
echo "Hello World!" > hw.log
launchctl在沒有錯誤的情況下加載它。 從shell執行腳本時,它按預期工作。 註銷並重新登錄不起作用。 在Google中找不到任何答案。 什麼是「怪異原因:8」的全部?
錯誤8是[ENOEXEC「Exec format error」](https://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man2/intro.2.html),所以這幾乎肯定是你的觀點2,破碎的線路。 –
同意,在第一種情況下錯誤是可能EACCES拒絕「權限」(13) – cody
謝謝,我已經添加shebang行給我的腳本。但現在它只是說,'13年4月3日8:43:39.606 PM com.apple.launchd.peruser.501 [139]:(nextstopsun.helloworld [47898])退出,代碼爲:1' – nextstopsun