* [ptxdist] [PATCH] lighttpd: Implement 'restart' in init script
@ 2015-01-08 21:22 Bernhard Walle
0 siblings, 0 replies; only message in thread
From: Bernhard Walle @ 2015-01-08 21:22 UTC (permalink / raw)
To: ptxdist; +Cc: Bernhard Walle
Signed-off-by: Bernhard Walle <bernhard@bwalle.de>
---
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
ptxdist@pengutronix.de
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2015-01-08 21:22 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-08 21:22 [ptxdist] [PATCH] lighttpd: Implement 'restart' in init script Bernhard Walle
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox