2014-03-27 45 views
0

我正在嘗試在Mac OS X上使用launchctl在登錄時運行簡單的腳本。launchctl start no process

當我運行launchctl start com.user.loginscript時,收到錯誤「launchctl start error:No such process」。如果我嘗試加載並使用plist文件,則檢查launchctl list會顯示錯誤代碼「1」。

我的plist文件是如下...

`

<!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>com.user.loginscript</string> 

    <key>Program</key> 

    <string>~/Movies/test.sh</string> 

    <key>RunAtLoad</key> 

    <true/> 

</dict> 

</plist> 

`

任何建議,可能什麼錯?

編輯:傻test.sh如下... #!/bin/bash say "Hello Myles"

回答

3

你需要使用的完整路徑腳本 - ~是一個shell速記,由於launchd會不及格程序名稱通過一個shell,它實際上是在尋找一個名爲「〜」的文件夾而不是你的home文件夾。