Mercurial > vanilla
diff Templates/rc @ 349:7b000befead5
vanilla: improve docs and hierarchy
author | David Demelier <markand@malikania.fr> |
---|---|
date | Thu, 28 Mar 2019 20:15:00 +0100 |
parents | templates/rc@36ef2cc4fafa |
children | 35eeda73d259 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Templates/rc Thu Mar 28 20:15:00 2019 +0100 @@ -0,0 +1,59 @@ +#!/bin/sh +# +# /etc/rc.d/template: run control script for template + +if [ -f /etc/rc.conf ]; then + source /etc/rc.conf +fi + +: ${TEMPLATE_CMD:=/usr/sbin/template} +: ${TEMPLATE_ARGS:=--foo} +: ${TEMPLATE_PID:=/var/run/template/template.pid} + +template_start() +{ + echo "Starting template: $TEMPLATE_CMD $TEMPLATE_ARGS" + $TEMPLATE_CMD $TEMPLATE_ARGS -p $TEMPLATE_PID +} + +template_status() +{ + if [ -s $TEMPLATE_PID ]; then + echo "template is running with pid: `cat $TEMPLATE_PID`" + else + echo "template is not running" + fi +} + +template_stop() +{ + if [ -s $TEMPLATE_PID ]; then + echo "Stopping template." + kill -QUIT `cat $TEMPLATE_PID` + fi +} + +template_restart() +{ + template_stop + sleep 3 + template_start +} + +case $1 in +start) + template_start + ;; +status) + template_status + ;; +stop) + template_stop + ;; +restart) + template_restart + ;; +*) + echo "usage: $(basename $0) restart|start|status|stop" + ;; +esac