2012-06-19 08:37:34 +02:00
|
|
|
#!/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 )
|
|
|
|
|
2015-10-17 16:05:22 +02:00
|
|
|
# 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
|
2012-06-19 08:37:34 +02:00
|
|
|
|
|
|
|
case "$1" in
|
2014-10-16 19:06:05 +02:00
|
|
|
start)
|
2015-10-17 16:05:22 +02:00
|
|
|
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
|
2014-10-26 18:41:43 +01:00
|
|
|
[ $? = 0 ] && echo "OK" || echo "FAIL"
|
2014-10-16 19:06:05 +02:00
|
|
|
;;
|
|
|
|
stop)
|
2015-10-17 16:05:22 +02:00
|
|
|
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
|
2014-10-26 18:41:43 +01:00
|
|
|
[ $? = 0 ] && echo "OK" || echo "FAIL"
|
2015-10-17 16:05:22 +02:00
|
|
|
rm -f /var/run/inadyn.pid
|
2014-10-16 19:06:05 +02:00
|
|
|
;;
|
|
|
|
restart)
|
|
|
|
"$0" stop
|
|
|
|
"$0" start
|
|
|
|
;;
|
|
|
|
*)
|
2014-10-26 18:41:44 +01:00
|
|
|
echo "Usage: $0 {start|stop|restart}"
|
2014-10-16 19:06:05 +02:00
|
|
|
exit 1
|
2012-06-19 08:37:34 +02:00
|
|
|
esac
|
|
|
|
|
|
|
|
exit $?
|