summaryrefslogtreecommitdiff
path: root/network/inadyn/rc.inadyn
blob: 96d576813646d37477c120ebfb2cd4a8318b2f2f (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
45
46
47
48
49
50
#!/bin/sh
#
# rc.inadyn    This shell script takes care of starting and stopping
#               inadyn.
#
# inadyn provides support for updating dynamic DNS services.

if [ ! -f /etc/inadyn.conf ]; then
	echo "Missing .conf file"
	echo "Exiting..."
	exit 1
fi

PIDFILE=/var/run/inadyn.pid
SCRIPTNAME=$0

case "$1" in
  start)
	echo -n "Starting inadyn: /usr/sbin/inadyn"
	/usr/sbin/inadyn --pidfile $PIDFILE
	echo    
	;;
  stop)
	echo -n "Stopping inadyn... "
	kill $( ps ax | grep inadyn | grep Ss | awk '{print $1}' )
	rm -f $PIDFILE
	echo
	;;
  restart)
	$SCRIPTNAME stop
	$SCRIPTNAME start
	;;
  status)
        pids=$( ps ax | grep inadyn | grep Ss | awk '{print $1}' )
	if test "$pids"
	then
		for p in $pids
		do
			echo "inadyn (pid $p) is running."
		done
	else
		echo "inadyn is not running."
	fi
	;;
  *)
	echo "Usage: inadyn {start|stop|restart|status}"
	exit 1
esac

exit 0