]> git.pld-linux.org Git - packages/ez-ipupdate.git/blob - ez-ipupdate.init
- rel 6; fixes from debian and new services from openwrt
[packages/ez-ipupdate.git] / ez-ipupdate.init
1 #!/bin/sh
2 #
3 # ez-ipupdate           ez-ipupdate (secure shell daemon)
4 #
5 # chkconfig:    345 55 45
6 #
7 # description:  ez-ipupdate - 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 PROGRAM_ARGS="-d -c /etc/ez-ipupdate.conf"
17 # Get service config
18 [ -f /etc/sysconfig/ez-ipupdate ] && . /etc/sysconfig/ez-ipupdate
19
20 # Check that networking is up.
21 if is_yes "${NETWORKING}"; then
22         if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
23                 msg_network_down "ez-ipupdate dynamic dns client"
24                 exit 1
25         fi
26 else
27         exit 0
28 fi
29
30 RETVAL=0
31 # See how we were called.
32 case "$1" in
33   start)
34         # Check if the service is already running?
35         if [ ! -f /var/lock/subsys/ez-ipupdate ]; then
36                 msg_starting "ez-ipupdate dynamic dns client"
37                 daemon /usr/bin/ez-ipupdate $PROGRAM_ARGS
38                 RETVAL=$?
39                 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/ez-ipupdate
40         else
41                 msg_already_running "ez-ipupdate dynamic dns client"
42         fi
43         ;;
44   stop)
45         if [ -f /var/lock/subsys/ez-ipupdate ]; then
46                 msg_stopping "ez-ipupdate dynamic dns client"
47                 killproc ez-ipupdate -QUIT
48                 rm -f /var/run/ez-ipupdate.pid /var/lock/subsys/ez-ipupdate >/dev/null 2>&1
49         else
50                 msg_not_running "ez-ipupdate dynamic dns client"
51         fi
52         ;;
53   restart|force-reload)
54         $0 stop
55         $0 start
56         exit $?
57         ;;
58   status)
59         status ez-ipupdate
60         RETVAL=$?
61         ez_cache=$(grep -E '^[[:space:]]*cache-file' /etc/ez-ipupdate.conf |  cut -d "=" -f2)
62         LAST_IP=$(cat $ez_cache | cut -d "," -f2)
63         echo "Last IP update: $LAST_IP"
64         exit $RETVAL
65         ;;
66   *)
67         msg_usage "$0 {start|stop|restart|force-reload|status}"
68         exit 3
69 esac
70
71 exit $RETVAL
This page took 0.096483 seconds and 3 git commands to generate.