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