Never been to TextSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

lighttpd as a startup item on os x (See related posts)

Create the /Library/StartupItems/Lighttpd directory, put both the Lighttpd (chmod +x) and the StartupParameters.plist (I don't really know what this does at all) files into the directory. (this is on jaguar, before the new launchd came out in tiger).

Then add the following line to /etc/hostconfig:


You can start, stop and restart lighttpd using /Library/StartupItems/Lighttpd (start|stop|restart) now, and it will startup when OS X boots.

-------- Lighttpd
# /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

# 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

StartService () 
  if [ "${LIGHTTPD:=-NO-}" = "-YES-" ] ; then
    ConsoleMessage "Starting Lighttpd Server"

StopService ()
  ConsoleMessage "Killing Lighttpd Server"
  kill `cat /var/run/` 

RestartService ()
        ConsoleMessage "Restarting Lighttpd server"
        /Library/StartupItems/Lighttpd/Lighttpd stop
        /Library/StartupItems/Lighttpd/Lighttpd start

if test -x $SCRIPT ; then
        RunService "$1"
        ConsoleMessage "Could not find lighttpd startup script!"

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" "">
<plist version="1.0">
        Lighttpd 1.13</string>

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.

Comments on this post

gasgarage posts on Aug 04, 2005 at 16:51
It works well for me though a lot of ruby processess don't get killed.

Perhaps its needed to be changed from:
kill `cat /var/run/`
kill -9 -u your_username `cat /var/run/`

I've added this too:
alias Lighttpd=/Library/StartupItems/Lighttpd/Lighttpd
to /etc/profile for easy restarting from terminal
gasgarage posts on Aug 04, 2005 at 17:03
Last entry doesn't work
I had to add:
 kill `cat /var/run/`
killall -9 ruby

You need to create an account or log in to post comments to this site.

Related Posts