summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rwxr-xr-xsbin/init.d/functions6
-rwxr-xr-xsbin/init.d/pdnsd38
3 files changed, 46 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 041ba2e..71d9a14 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2003/10/02 : 0.3.24
+- functions : 'do_restart' now does its best to kill frozen processes and to
+ bypass defuncts. Its goal is now clearly to get the service up at any cost.
+- pdnsd has been rewritten to work around conceptual flaws in this daemon.
+ It is now marked as deprecated since it's available in the latest pdnsd package.
+2003/09/30
+- pdnsd : fixed wrong pidfile ; clear cache if it exists.
2003/09/15
- changelog is now in english
- functions : a bit more verbose about what is done during start/stop
diff --git a/sbin/init.d/functions b/sbin/init.d/functions
index 883e256..491ba41 100755
--- a/sbin/init.d/functions
+++ b/sbin/init.d/functions
@@ -1,7 +1,7 @@
#!/bin/bash
#
-# sbin/init.d/functions - Formilux init script - version 0.3.23 - 2003-09-15
+# sbin/init.d/functions - Formilux init script - version 0.3.24 - 2003-10-02
#
# Copyright (C) 2001-2003 Benoit Dolez & Willy Tarreau
# mailto: benoit@ant-computing.com,willy@ant-computing.com
@@ -476,8 +476,10 @@ function do_stop {
return 0
}
+# we *absolutely* want to restart the service, even if it's frozen as "defunct"
function do_restart {
- do_stop $* && do_start $*
+ do_stop $* || ( FORCE_START_STOP=1 do_stop $* )
+ do_start $*
}
# returns a basic check of the service, an returns one line of info of the form:
diff --git a/sbin/init.d/pdnsd b/sbin/init.d/pdnsd
index 9adeb55..fbc3769 100755
--- a/sbin/init.d/pdnsd
+++ b/sbin/init.d/pdnsd
@@ -3,14 +3,46 @@
. `dirname $0`/functions
option config standard_option /etc/pdnsd.conf
-option pidfile reserved_option /var/run/syslog-ng.pid
+option pidfile reserved_option /var/run/pdnsd.pid
option bin reserved_option /usr/sbin/pdnsd
option cmdline reserved_option '$bin -c $opt_config -d -p $pidfile'
-# perform a forced synchronisation before starting the daemon
+# reinitialize the cache before starting the daemon
function fct_pre_start {
- if [ ! -d /var/cache/pdnsd ] ; then mkdir -p /var/cache/pdnsd ; fi
+ local user="$($bin -c $opt_config --pdnsd-user 2>/dev/null)"
+
+ if [ ! -d /var/cache/pdnsd ]; then
+ rm -f /var/cache/pdnsd >/dev/null 2>&1
+ mkdir -p /var/cache/pdnsd
+ fi
+
+ # compilation defaults state that default user is "nobody"
+ user="${user:-nobody}"
+ grep -q "^$user:" /etc/passwd || user="nobody"
+
+ # unconditionally rebuild the cache :
+ # - either it's empty and pdnsd will not start
+ # - or it's filled, but if damaged, it may crash
+ rm -f /var/cache/pdnsd/pdnsd.cache 2>/dev/null
+ dd if=/dev/zero of=/var/cache/pdnsd/pdnsd.cache bs=4 count=1 >/dev/null 2>&1
+ chown $user:adm /var/cache/pdnsd /var/cache/pdnsd/pdnsd.cache
+ chmod 750 /var/cache/pdnsd
+ chmod 640 /var/cache/pdnsd/pdnsd.cache
+ return 0
+}
+
+# this function ensures that the daemon really dies, even if multiple
+# pids appear while the pidfile only references one.
+function fct_post_stop {
+ local -a pids
+ local pid=$$
+
+ pids=( $(pidof -o $pid pdnsd) )
+ [ ${#pids[@]} -eq 0 ] && return 0
+ kill ${pids[@]} >/dev/null 2>&1
+ kill -9 ${pids[@]} >/dev/null 2>&1
+ return 0
}
load_config