Shell Script doesn't run automatically though it is registered in Mac OS X Login Items
I have the following shell script registered in my "Login Items" preferences but it does not seem to have any effect. It is meant to launch the moinmoin wiki but only works when it is run by hand from a terminal window, after which it runs until the machine is next shut down.
#!/bin/bash cd /Users/stuartcw/Documents/Wiki/moin-1.7.2 /usr/bin/python wikiserver.py >> logs/`date +"%d%b%Y"`.log 2>&1 &
I would really like the Wiki to be available after restarting so any help in understanding this would be appreciated.
launchd is one of the best parts of MacOS X, and it causes me great pain to not be able to find it on other systems.
Edit and place this in /Library/LaunchDaemons as com.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>
Try using launchd. More info at http://www.macgeekery.com/tips/all_about_launchd_items_and_how_to_make_one_yourself
Some helpful links:
See also Lingon for a front end, should you decide to use Launchd instead.
I don't know much about it, since I don't use login items. Just a suggestion, maybe try with applescript that calls those shell commands, and put that in Login Items.