From: Bernhard Walle <bernhard@bwalle.de>
To: ptxdist@pengutronix.de
Cc: Bernhard Walle <bernhard@bwalle.de>
Subject: [ptxdist] [PATCH] lighttpd: Implement 'restart' in init script
Date: Thu, 8 Jan 2015 22:22:09 +0100 [thread overview]
Message-ID: <1420752129-659-1-git-send-email-bernhard@bwalle.de> (raw)
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
reply other threads:[~2015-01-08 21:22 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1420752129-659-1-git-send-email-bernhard@bwalle.de \
--to=bernhard@bwalle.de \
--cc=ptxdist@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox