2008-12-03 76 views
4

我在以下「登錄項目」首選項中註冊了以下shell腳本,但似乎沒有任何效果。這意味着啓動moinmoin維基,但只有當它從終端窗口手動運行時才起作用,然後運行,直到機器下一次關閉。Shell腳本雖然已在Mac OS X中註冊,但並未自動運行登錄項目

#!/bin/bash 
cd /Users/stuartcw/Documents/Wiki/moin-1.7.2 
/usr/bin/python wikiserver.py >> logs/`date +"%d%b%Y"`.log 2>&1 & 

我真的很喜歡重新啓動後可用的Wiki,所以任何幫助理解這將不勝感激。

回答

4

launchd是MacOS X中最好的部分之一,它讓我非常痛苦,無法在其他系統上找到它。

編輯和地方這/Library/LaunchDaemonscom.you.wiki.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>Label</key> 
    <string>com.you.wiki</string> 
    <key>LowPriorityIO</key> 
    <true/> 
    <key>KeepAlive</key> 
    <true/> 
    <key>RunAtLoad</key> 
    <true/> 
    <key>Nice</key> 
    <integer>1</integer> 
    <key>WorkingDirectory</key> 
    <string>/Users/stuartcw/Documents/Wiki/moin-1.7.2</string> 
    <key>UserName</key> 
    <string>user to run this as</string> 
    <key>ProgramArguments</key> 
    <array> 
     <string>/usr/bin/python</string> 
     <string>wikiserver.py</string> 
    </array> 
</dict> 
</plist> 
+0

全部細節在這裏:http://developer.apple.com/MacOsX/launchd.html 我目前正在考慮將它放入我的LaunchAgents文件夾。 「如果它只在用戶登錄時纔有用,請將其放入/ Library/LaunchAgents或特定用戶的個人LaunchAgents目錄中。」 – stuartcw 2008-12-03 12:46:37

1

我不太瞭解它,因爲我沒有使用登錄項。只是一個建議,也許嘗試用調用這些shell命令的applescript,然後將它放在Login Items中。