From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from smtprelay04.ispgateway.de ([80.67.29.8]) by metis.ext.pengutronix.de with esmtp (Exim 4.72) (envelope-from ) id 1Y9KX0-0005bD-QP for ptxdist@pengutronix.de; Thu, 08 Jan 2015 22:22:15 +0100 From: Bernhard Walle Date: Thu, 8 Jan 2015 22:22:09 +0100 Message-Id: <1420752129-659-1-git-send-email-bernhard@bwalle.de> Subject: [ptxdist] [PATCH] lighttpd: Implement 'restart' in init script Reply-To: ptxdist@pengutronix.de List-Id: PTXdist Development Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: ptxdist-bounces@pengutronix.de Errors-To: ptxdist-bounces@pengutronix.de To: ptxdist@pengutronix.de Cc: Bernhard Walle Signed-off-by: Bernhard Walle --- 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