summaryrefslogtreecommitdiff
path: root/network/ddclient/rc.ddclient
blob: cb88a8dd261f171ddf6217f896d5cd00584291ce (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
#!/bin/sh
#
# ddclient      This shell script takes care of starting and stopping
#               ddclient.
#
# ddclient provides support for updating dynamic DNS services.

[ -f /etc/ddclient/ddclient.conf ] || exit 1

case "$1" in
  start)
	echo -n "Starting ddclient: "
	ddclient
	echo    
	;;
  stop)
	echo -n "Shutting down ddclient: "
	#kill $( ps -aef | grep ddclient | grep sleeping | awk '{print$2}' )
	kill -9 $( cat /var/run/ddclient.pid )
	echo
	;;
  restart)
	$0 stop
	$0 start
	;;
  status)
	pids=$( ps -aef | grep ddclient | grep sleeping | awk '{print$2}' )
	if test "$pids"
	then
		for p in $pids
		do
			echo "ddclient (pid $p) is running."
		done
	else
		echo "ddclient is stopped."
	fi
	;;
  *)
	echo "Usage: ddclient {start|stop|restart|status}"
	exit 1
esac

exit 0