summaryrefslogtreecommitdiff
path: root/recipes-core/multitech/reset-handler/reset-handler.init
blob: b50e7b8156a41a410d5513c87d4aa96489366e9f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/sh

DAEMON=/usr/sbin/reset-handler
PIDFILE=/var/run/reset-handler.pid
ENABLED="yes"

[ -r /etc/default/reset-handler ] && . /etc/default/reset-handler
[ -x $DAEMON ] || exit 0
[ "$ENABLED" = "yes" ] || exit 0

case "$1" in
	start)
		if [ -f $PIDFILE ]; then
			echo "reset-handler pid file exists, not starting"
			exit 1
		else
			echo "Starting reset-handler"
			start-stop-daemon --start --background --make-pidfile --pidfile $PIDFILE --exec $DAEMON
		fi
	;;
	stop)
		echo "Stopping reset-handler"
		start-stop-daemon --stop --oknodo --pidfile $PIDFILE
		rm -f $PIDFILE
	;;
	*)
		echo "Usage: $0 {start|stop}"
		exit 2
	;;
esac