1#!/bin/sh
2#
3# lighttpd     Startup script for the lighttpd server
4#
5# chkconfig: - 85 15
6# description: Lightning fast webserver with light system requirements
7#
8# processname: lighttpd
9# config: /etc/lighttpd/lighttpd.conf
10# config: /etc/sysconfig/lighttpd
11# pidfile: /var/run/lighttpd.pid
12#
13# Note: pidfile is assumed to be created
14# by lighttpd (config: server.pid-file).
15# If not, uncomment 'pidof' line.
16
17# Source function library
18. /etc/rc.d/init.d/functions
19
20if [ -f /etc/sysconfig/lighttpd ]; then
21	. /etc/sysconfig/lighttpd
22fi
23
24if [ -z "$LIGHTTPD_CONF_PATH" ]; then
25	LIGHTTPD_CONF_PATH="/etc/lighttpd/lighttpd.conf"
26fi
27
28prog="lighttpd"
29lighttpd="/usr/sbin/lighttpd"
30RETVAL=0
31
32start() {
33	echo -n $"Starting $prog: "
34	daemon $lighttpd -f $LIGHTTPD_CONF_PATH
35	RETVAL=$?
36	echo
37	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog
38	return $RETVAL
39}
40
41stop() {
42	echo -n $"Stopping $prog: "
43	killproc $lighttpd
44	RETVAL=$?
45	echo
46	[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog
47	return $RETVAL
48}
49
50reload() {
51	echo -n $"Reloading $prog: "
52	killproc $lighttpd -HUP
53	RETVAL=$?
54	echo
55	return $RETVAL
56}
57
58case "$1" in
59	start)
60		start
61		;;
62	stop)
63		stop
64		;;
65	restart)
66		stop
67		start
68		;;
69	condrestart)
70		if [ -f /var/lock/subsys/$prog ]; then
71			stop
72			start
73		fi
74		;;
75	reload)
76		reload
77		;;
78	status)
79		status $lighttpd
80		RETVAL=$?
81		;;
82	*)
83		echo $"Usage: $0 {start|stop|restart|condrestart|reload|status}"
84		RETVAL=1
85esac
86
87exit $RETVAL
88