comparison 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
comparison
equal deleted inserted replaced
348:c669b5463d04 349:7b000befead5
1 #!/bin/sh
2 #
3 # /etc/rc.d/template: run control script for template
4
5 if [ -f /etc/rc.conf ]; then
6 source /etc/rc.conf
7 fi
8
9 : ${TEMPLATE_CMD:=/usr/sbin/template}
10 : ${TEMPLATE_ARGS:=--foo}
11 : ${TEMPLATE_PID:=/var/run/template/template.pid}
12
13 template_start()
14 {
15 echo "Starting template: $TEMPLATE_CMD $TEMPLATE_ARGS"
16 $TEMPLATE_CMD $TEMPLATE_ARGS -p $TEMPLATE_PID
17 }
18
19 template_status()
20 {
21 if [ -s $TEMPLATE_PID ]; then
22 echo "template is running with pid: `cat $TEMPLATE_PID`"
23 else
24 echo "template is not running"
25 fi
26 }
27
28 template_stop()
29 {
30 if [ -s $TEMPLATE_PID ]; then
31 echo "Stopping template."
32 kill -QUIT `cat $TEMPLATE_PID`
33 fi
34 }
35
36 template_restart()
37 {
38 template_stop
39 sleep 3
40 template_start
41 }
42
43 case $1 in
44 start)
45 template_start
46 ;;
47 status)
48 template_status
49 ;;
50 stop)
51 template_stop
52 ;;
53 restart)
54 template_restart
55 ;;
56 *)
57 echo "usage: $(basename $0) restart|start|status|stop"
58 ;;
59 esac