]> git.pld-linux.org Git - packages/ddclient.git/blob - ddclient.init
- tabs in preamble
[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 [ -f /etc/sysconfig/ddclient ] && . /etc/sysconfig/ddclient
18
19 # Check that networking is up.
20 if is_yes "${NETWORKING}"; then
21         if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
22                 msg_network_down "Dynamic DNS Client"
23                 exit 1
24         fi
25 else
26         exit 0
27 fi
28
29 start() {
30         # Check if the service is already running?
31         if [ ! -f /var/lock/subsys/ddclient ]; then
32                 msg_starting "Dynamic DNS Client"
33                 daemon /usr/sbin/ddclient -daemon 300
34                 RETVAL=$?
35                 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/ddclient
36         else
37                 msg_already_running "Dynamic DNS Client"
38         fi
39 }
40
41 stop() {
42         if [ -f /var/lock/subsys/ddclient ]; then
43                 msg_stopping "Dynamic DNS Client"
44                 killproc ddclient
45                 rm -f /var/run/ddclient.pid /var/lock/subsys/ddclient >/dev/null 2>&1
46         else
47                 msg_not_running "Dynamic DNS Client"
48         fi
49 }
50
51 RETVAL=0
52 # See how we were called.
53 case "$1" in
54   start)
55         start
56         ;;
57   stop)
58         stop
59         ;;
60   restart)
61         stop
62         start
63         ;;
64   status)
65         status ddclient
66         exit $?
67         ;;
68   reload|force-reload)
69         if [ -f /var/lock/subsys/ddclient ]; then
70                 msg_reloading "Dynamic DNS Client"
71                 killproc ddclient -HUP
72                 RETVAL=$?
73         else
74                 msg_not_running "Dynamic DNS Client"
75                 exit 7
76         fi
77         ;;
78   *)
79         msg_usage "$0 {start|stop|restart|reload|force-reload|status}"
80         exit 3
81 esac
82
83 exit $RETVAL
This page took 0.068694 seconds and 3 git commands to generate.