]>
Commit | Line | Data |
---|---|---|
10e3bd00 AM |
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 | ||
b604c92d | 16 | PROGRAM_ARGS="-d -c /etc/ez-ipupdate.conf" |
10e3bd00 AM |
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 | |
b604c92d | 29 | |
10e3bd00 AM |
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" | |
b604c92d | 37 | daemon /usr/bin/ez-ipupdate $PROGRAM_ARGS |
10e3bd00 | 38 | RETVAL=$? |
7d0b1678 | 39 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/ez-ipupdate |
10e3bd00 AM |
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" | |
b604c92d | 47 | killproc ez-ipupdate -QUIT |
10e3bd00 AM |
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" | |
7d0b1678 | 51 | fi |
10e3bd00 | 52 | ;; |
5a1d91f4 | 53 | restart|force-reload) |
10e3bd00 AM |
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 | ;; | |
10e3bd00 | 66 | *) |
5a1d91f4 | 67 | msg_usage "$0 {start|stop|restart|force-reload|status}" |
10e3bd00 AM |
68 | exit 3 |
69 | esac | |
70 | ||
71 | exit $RETVAL |