b20048ce8c0d949255c07a007649c5e4c97ac5f9
[packages/trusty/cirros-testvm.git] / cirros-testvm / src-cirros / buildroot-2015.05 / package / inadyn / S70inadyn
1 #!/bin/sh
2 #
3 # Start & stop the inadyn client
4 #
5
6 CONFIG=/etc/inadyn.conf
7 VR_INADYN=/var/run/inadyn
8
9 # check if CONFIG exists, print message & exit if it doesn't
10 [ ! -f $CONFIG ] && ( echo "The config file "$CONFIG" is missing...exiting now." && exit 2 )
11
12 # check if VR_INADYN exists, create it if not
13 [ ! -d $VR_INADYN ] && mkdir -p $VR_INADYN
14
15 case "$1" in
16         start)
17                 echo "Starting inadyn: "
18                 start-stop-daemon -S -x /usr/bin/inadyn
19                 [ $? = 0 ] && echo "OK" || echo "FAIL"
20                 ;;
21         stop)
22                 echo  "Stopping inadyn: "
23                 start-stop-daemon -q -K -x /usr/bin/inadyn
24                 [ $? = 0 ] && echo "OK" || echo "FAIL"
25                 rm -f /var/run/inadyn/inadyn.pid
26                 ;;
27         restart)
28                 "$0" stop
29                 "$0" start
30                 ;;
31                 *)
32                 echo "Usage: $0 {start|stop|restart}"
33                 exit 1
34 esac
35
36 exit $?