社區!OSX launchd - 在後臺會話中運行腳本會忽略StartInterval
我想在我的OSX 10.7.4上每5分鐘執行一個簡單的腳本。它應該運行無論用戶登錄到機器或沒有(又名背景會話)
因此我創造了我/System/Library/LaunchDaemons/
com.me.script.plist,並通過加載它:launchctl -S background ./com.me.script.plist
,並通過它開始:launchchctl start com.me.script
它第一次運行良好。但是,在我設置的300秒間隔後它再也不會運行!
你們對此有何建議?如果我在Aqua Session中運行它,它會很好地工作,但是,這意味着它只會在用戶登錄時運行。但是,我真的需要它在此之前開始運行...並且繼續這樣做如果用戶登錄/註銷或其他用戶登錄/註銷,則至關重要。
這裏是我的plist:
<?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>LimitLoadToSessionType</key>
<string>Background</string>
<key>Label</key>
<string>com.me.script</string>
<key>ProgramArguments</key>
<array>
<string>/usr/bin/php</string>
<string>/Sites/script/notifier.php</string>
</array>
<key>StartInterval</key>
<integer>900</integer>
</dict>
</plist>
我將它添加到根目錄中,以便每個用戶都可以訪問它..我發現我的問題:StartInterval被設置爲900 ..而不是300.對不起 – opfeffer 2012-08-08 16:58:27