Signed-off-by: Bernhard Walle <[email protected]>
---
 generic/etc/init.d/lighttpd | 46 ++++++++++++++++++++++++++++++---------------
 1 file changed, 31 insertions(+), 15 deletions(-)

diff --git a/generic/etc/init.d/lighttpd b/generic/etc/init.d/lighttpd
index d776c58..24a17e2 100644
--- a/generic/etc/init.d/lighttpd
+++ b/generic/etc/init.d/lighttpd
@@ -9,30 +9,46 @@ PREFIX="lighttpd: "
 LIGHTTPD="/usr/sbin/lighttpd"
 LIGHTTPD_CONF="/etc/lighttpd/lighttpd.conf"
 
+start()
+{
+       echo "${PREFIX}starting"
+
+       if start-stop-daemon --start --quiet --oknodo --exec ${LIGHTTPD} -- -f 
${LIGHTTPD_CONF}; then
+               echo "${PREFIX}done"
+       else
+               echo "${PREFIX}error, could not start server"
+       fi
+}
+
+stop()
+{
+       echo "${PREFIX}stoppping"
+
+       if start-stop-daemon --stop --quiet --oknodo --exec ${LIGHTTPD}; then
+               echo "${PREFIX}done"
+       else
+               echo "${PREFIX}error, could not stop server"
+       fi
+}
+
 case $1 in
 
        start)
-               echo "${PREFIX}starting"
-
-               if start-stop-daemon --start --quiet --oknodo --exec 
${LIGHTTPD} -- -f ${LIGHTTPD_CONF}; then
-                       echo "${PREFIX}done"
-               else
-                       echo "${PREFIX}error, could not start server"
-               fi
+               start
                ;;
 
        stop)
-               echo "${PREFIX}stoppping"
-
-               if start-stop-daemon --stop --quiet --oknodo --exec 
${LIGHTTPD}; then
-                       echo "${PREFIX}done"
-               else
-                       echo "${PREFIX}error, could not stop server"
-               fi
+               stop
                ;;
 
+       restart|force-reload)
+               stop
+               sleep 1
+               start
+        ;;
+
        *)
-               echo "${PREFIX}usage: ${0} [start|stop]"
+               echo "${PREFIX}usage: ${0} [start|stop|restart]"
                exit 1
                ;;
 
-- 
2.2.1


-- 
ptxdist mailing list
[email protected]

Reply via email to