]> git.pld-linux.org Git - packages/ddclient.git/blob - ddclient.init
up to 3.11.2
[packages/ddclient.git] / ddclient.init
1 #!/bin/sh
2 #
3 # ddclient              ddclient (secure shell daemon)
4 #
5 # chkconfig:    345 55 45
6 #
7 # description:  ddclient - dynamic dns client
8
9
10 # Source function library
11 . /etc/rc.d/init.d/functions
12
13 # Get network config
14 . /etc/sysconfig/network
15
16 # Get service config
17 DDCLIENT_OPTIONS="-daemon 300"
18 [ -f /etc/sysconfig/ddclient ] && . /etc/sysconfig/ddclient
19
20 pidfile=/var/run/ddclient/ddclient.pid
21
22 # Check that networking is up.
23 if is_yes "${NETWORKING}"; then
24         if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
25                 msg_network_down "Dynamic DNS Client"
26                 exit 1
27         fi
28 else
29         exit 0
30 fi
31
32 start() {
33         # Check if the service is already running?
34         if [ -f /var/lock/subsys/ddclient ]; then
35                 msg_already_running "Dynamic DNS Client"
36                 return
37         fi
38
39         msg_starting "Dynamic DNS Client"
40         daemon --user ddclient /usr/sbin/ddclient -pid $pidfile $DDCLIENT_OPTIONS
41         RETVAL=$?
42         [ $RETVAL -eq 0 ] && touch /var/lock/subsys/ddclient
43 }
44
45 stop() {
46         if [ ! -f /var/lock/subsys/ddclient ]; then
47                 msg_not_running "Dynamic DNS Client"
48                 return
49         fi
50
51         msg_stopping "Dynamic DNS Client"
52         killproc --pidfile $pidfile ddclient
53         rm -f $pidfile /var/lock/subsys/ddclient >/dev/null 2>&1
54 }
55
56 reload() {
57         if [ ! -f /var/lock/subsys/ddclient ]; then
58                 msg_not_running "Dynamic DNS Client"
59                 RETVAL=7
60                 return
61         fi
62
63         msg_reloading "Dynamic DNS Client"
64         killproc ddclient -HUP
65         RETVAL=$?
66 }
67
68 RETVAL=0
69 # See how we were called.
70 case "$1" in
71   start)
72         start
73         ;;
74   stop)
75         stop
76         ;;
77   restart)
78         stop
79         start
80         ;;
81   reload|force-reload)
82         reload
83         ;;
84   status)
85         status --pidfile $pidfile ddclient
86         exit $?
87         ;;
88   *)
89         msg_usage "$0 {start|stop|restart|reload|force-reload|status}"
90         exit 3
91 esac
92
93 exit $RETVAL
This page took 0.076092 seconds and 3 git commands to generate.