4
# Provides: ez-ipupdate
5
# Required-Start: $local_fs $remote_fs $network
6
# Required-Stop: $local_fs $remote_fs $network
7
# Default-Start: 2 3 4 5
9
# Short-Description: ez-ipupdate client for dynamic DNS services
12
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
13
DAEMON=/usr/sbin/ez-ipupdate
15
DESC="Dynamic DNS client"
17
test -f "$DAEMON" || exit 0
21
# Create the directory where the PID file will be stored
22
if [ ! -d "/var/run/$NAME" ]; then
23
mkdir -p "/var/run/$NAME"
24
chown ez-ipupd "/var/run/$NAME"
29
echo -n "Starting $DESC:"
30
configs=`find "/etc/$NAME/" -name '*.conf' | \
31
sed -e 's,.*/\(.*\).conf,\1,'`
32
if [ x"$configs" = x ]
34
echo " no .conf file in /etc/$NAME."
39
for config in `echo "$configs"`
41
# Don't run configurations that are not daemons
42
if ! grep -q '^ *daemon' "/etc/$NAME/$config.conf"; then continue; fi
43
# Don't run configurations that run in the foreground
44
if grep -q '^ *foreground' "/etc/$NAME/$config.conf"; then continue; fi
45
# Ok, launch an ez-ipupdate instance
46
if start-stop-daemon --start --quiet \
47
--pidfile "/var/run/$NAME/$config.pid" \
49
-- -d -c "/etc/$NAME/$config.conf" \
50
-F "/var/run/$NAME/$config.pid"
58
echo -n "Stopping $DESC:"
59
pidfiles=`find "/var/run/$NAME/" -name "*.pid" | \
60
sed -e 's,.*/\(.*\).pid,\1,'`
61
if [ x"$pidfiles" = x ]
63
echo " no $NAME running."
68
for pidfile in `echo "$pidfiles"`
70
if start-stop-daemon --stop --signal 3 --quiet \
71
--pidfile "/var/run/$NAME/$pidfile.pid"
79
echo -n "Reloading $DESC configuration files:"
80
pidfiles=`find "/var/run/$NAME" -name "*.pid" | \
81
sed -e 's,.*/\(.*\).pid,\1,'`
82
if [ x"$pidfiles" = x ]
84
echo " no $NAME running."
89
for pidfile in `echo "$pidfiles"`
91
if start-stop-daemon --stop --signal 1 --quiet \
92
--pidfile "/var/run/$NAME/$pidfile.pid"
105
N="/etc/init.d/$NAME"
106
echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2