Then add the following line to /etc/hostconfig:
LIGHTTPD=-YES-
You can start, stop and restart lighttpd using /Library/StartupItems/Lighttpd (start|stop|restart) now, and it will startup when OS X boots.
-------- Lighttpd
#!/bin/sh # # /Library/StartupItems/Lighttpd/Lighttpd # # Script to startup lighttpd with OS X booting. # OS X 10.3 Jaguar # modified by kjell olsen # # adapted from the startup mysql # (c) 2003 MySQL AB # Written by Lenz Grimmer# # Suppress the annoying "$1: unbound variable" error when no option # was given if [ -z $1 ] ; then echo "Usage: $0 [start|stop|restart] " exit 1 fi # Source the common setup functions for startup scripts test -r /etc/rc.common || exit 1 . /etc/rc.common # change config and script to match your machine's lighttpd config and lighttpd CONFIG="/etc/lighttpd/lighttpd.conf" SCRIPT="/usr/local/sbin/lighttpd" StartService () { if [ "${LIGHTTPD:=-NO-}" = "-YES-" ] ; then ConsoleMessage "Starting Lighttpd Server" $SCRIPT -f $CONFIG fi } StopService () { ConsoleMessage "Killing Lighttpd Server" kill `cat /var/run/lighttpd.pid` } RestartService () { ConsoleMessage "Restarting Lighttpd server" /Library/StartupItems/Lighttpd/Lighttpd stop /Library/StartupItems/Lighttpd/Lighttpd start } if test -x $SCRIPT ; then RunService "$1" else ConsoleMessage "Could not find lighttpd startup script!" fi
Be sure to change $SCRIPT + $CONFIG to work with your own lighttpd.
-------- StartupParameters.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>Descriptionkey>Lighttpd 1.13< /string> <key>OrderPreferencekey>None< /string> <key>Provideskey>/string> array> Lighttpd< Uses< /key> <array> <string>Networkstring>Resolver< /string> array> </dict> plist>
Again, I'm not exactly sure what this does. I copied it from the MYSQL one and changed the description and provider, left "uses" alone.
Perhaps its needed to be changed from:
kill `cat /var/run/lighttpd.pid`
to:
kill -9 -u your_username `cat /var/run/lighttpd.pid`
I've added this too:
alias Lighttpd=/Library/StartupItems/Lighttpd/Lighttpd
to /etc/profile for easy restarting from terminal