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