1#!/bin/sh 2# 3# Start & stop the inadyn client 4# 5 6CONFIG=/etc/inadyn.conf 7 8# check if CONFIG exists, print message & exit if it doesn't 9[ ! -f $CONFIG ] && ( echo "The config file "$CONFIG" is missing...exiting now." && exit 2 ) 10 11# Allow a few customizations from a config file. Especially inadyn 12# must be explicitly enabled by adding ENABLED="yes" in this file. 13test -r /etc/default/inadyn && . /etc/default/inadyn 14 15case "$1" in 16 start) 17 printf "Starting inadyn: " 18 if test "${ENABLED}" != "yes" ; then 19 echo "SKIPPED" 20 exit 0 21 fi 22 start-stop-daemon -b -q -S -p /var/run/inadyn.pid -x /usr/sbin/inadyn 23 [ $? = 0 ] && echo "OK" || echo "FAIL" 24 ;; 25 stop) 26 printf "Stopping inadyn: " 27 if test "${ENABLED}" != "yes" ; then 28 echo "SKIPPED" 29 exit 0 30 fi 31 start-stop-daemon -q -K -p /var/run/inadyn.pid -x /usr/sbin/inadyn 32 [ $? = 0 ] && echo "OK" || echo "FAIL" 33 rm -f /var/run/inadyn.pid 34 ;; 35 restart) 36 "$0" stop 37 "$0" start 38 ;; 39 *) 40 echo "Usage: $0 {start|stop|restart}" 41 exit 1 42esac 43 44exit $? 45