File: sample-etc_rc.d_init.d_ddclient

package info (click to toggle)
ddclient 3.6.2-3.1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 312 kB
  • ctags: 94
  • sloc: perl: 1,882; sh: 332; makefile: 42
file content (52 lines) | stat: -rwxr-xr-x 909 bytes parent folder | download | duplicates (2)
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
51
52
#!/bin/sh
#
# ddclient      This shell script takes care of starting and stopping
#               ddclient.
#
# chkconfig: 2345 65 35
# description: ddclient provides support for updating dynamic DNS services.

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

PATH=/usr/sbin:/root/bin:${PATH}
COLUMNS=9999
export PATH COLUMNS

program=ddclient
# See how we were called.
case "$1" in
  start)
	# Start daemons.
	echo -n "Starting ddclient: "
	ddclient -daemon 300
	echo    
	;;
  stop)
	# Stop daemons.
	echo -n "Shutting down ddclient: "
	kill `ps -aef | awk '/[ \/]perl.*ddclient/ { print $2}'`
	echo
	;;
  restart)
	$0 stop
	$0 start
	;;
  status)
	pids=`ps -aef | awk '/[ \/]perl.*ddclient/ { print $2}'`
	if test "$pids"
	then
		for p in $pids
		do
			echo "$program (pid $p) is running"
		done
	else
		echo "$program is stopped"
	fi
	;;
  *)
	echo "Usage: ddclient {start|stop|restart|status}"
	exit 1
esac

exit 0