summaryrefslogtreecommitdiffstats
path: root/package/inadyn/S70inadyn
blob: ca7b4146781794f1e1be1e68b5abb68097923597 (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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/sh
#
# Start & stop the inadyn client
#

CONFIG=/etc/inadyn.conf

# check if CONFIG exists, print message & exit if it doesn't
[ ! -f $CONFIG ] && ( echo "The config file "$CONFIG" is missing...exiting now." && exit 2 )

# Allow a few customizations from a config file. Especially inadyn
# must be explicitly enabled by adding ENABLED="yes" in this file.
test -r /etc/default/inadyn && . /etc/default/inadyn

case "$1" in
	start)
		printf "Starting inadyn: "
		if test "${ENABLED}" != "yes" ; then
		    echo "SKIPPED"
		    exit 0
		fi
		start-stop-daemon -b -q -S -p /var/run/inadyn.pid -x /usr/sbin/inadyn
		[ $? = 0 ] && echo "OK" || echo "FAIL"
		;;
	stop)
		printf "Stopping inadyn: "
		if test "${ENABLED}" != "yes" ; then
		    echo "SKIPPED"
		    exit 0
		fi
		start-stop-daemon -q -K -p /var/run/inadyn.pid -x /usr/sbin/inadyn
		[ $? = 0 ] && echo "OK" || echo "FAIL"
		rm -f /var/run/inadyn.pid
		;;
	restart)
		"$0" stop
		"$0" start
		;;
		*)
		echo "Usage: $0 {start|stop|restart}"
		exit 1
esac

exit $?
OpenPOWER on IntegriCloud