lighttpd and launchd
On a couple of occasions, I've noticed lighttpd silently dying on my remote Mac Mini that serves up a bunch of my sites including Quisition. I was switching hemispheres earlier in the week and so didn't notice for days. So I finally decided to get around to learning how to use launchd.
Turned out to be very simple.
I previously manually started lighttpd with:
sudo /usr/local/sbin/lighttpd -f /usr/local/www/lighttpd.conf
To start it (and keep it running) using launchd, I created a file:
sudo pico /Library/LaunchDaemons/net.lighttpd.plist
with the following content:
<?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>net.lighttpd</string>
<key>OnDemand</key>
<false/>
<key>Program</key>
<string>/usr/local/sbin/lighttpd</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/sbin/lighttpd</string>
<string>-f/usr/local/www/lighttpd.conf</string>
<string>-D</string>
</array>
</dict>
</plist>
(note the extra -D option) and told launchd about it with:
sudo launchctl load /Library/LaunchDaemons/net.lighttpd.plist
Just for fun, I tried killing lighttpd and launchd had dutifully restarted it before I had time to type 'ps aux'
Comments (0)
Add a Comment
Last Modified: April 29, 2006
Author: jtauber