On Sun, Oct 08, 2006 at 09:07:53PM (GMT-0300), Kai Hendry wrote:
> I should have thought about it a little harder. Check out:
> http://hendry.iki.fi/debian/unstable/maradns_1.2.12.02-3.diff.gz
Wrong again, but this time it's entirely my fault: "ps" right aligns
pids, so we cannot use "cut" (my patch only worked for pids between 1000
and 9999).
The attached patch made against 1.2.12.02-3 (ready to be applied this
time) fixes this issue and also adds the following:
- it fixes the file layout (tabs which were converted to spaces in
previous patches)
- it doesn't fail or even output a warning anymore if
"(maradns|zoneserver) stop" is run multiple times (by removing the pid
files, adding "--oknodo" in zoneserver and adapting my previous patch)
Does it seem ok to you ?
Thanks.
--
Boris Dorès
diff -r maradns-1.2.12.02-3/debian/maradns.init
maradns-1.2.12.02/debian/maradns.init
48a49
> rm -f /var/run/$SERVERNAME.pid
diff -r maradns-1.2.12.02-3/debian/maradns.zoneserver.init
maradns-1.2.12.02/debian/maradns.zoneserver.init
40c40
< --exec $DAEMON -- -f $rcfile </dev/null 2>&1 | logger -p daemon.notice
-t $SERVERNAME 2>/dev/null &
---
> --exec $DAEMON -- -f $rcfile </dev/null 2>&1 | logger -p
> daemon.notice -t $SERVERNAME 2>/dev/null &
53,55c53,61
< ps h --ppid `cat /var/run/$SERVERNAME.pid` | cut -d ' ' -f 2 | xargs
kill
< start-stop-daemon --stop -m --quiet --pidfile
/var/run/$SERVERNAME.pid \
< $DAEMON
---
> PIDFILE=/var/run/$SERVERNAME.pid
> if [ -f $PIDFILE ]; then
> CHILDPROCESSES=`cat $PIDFILE | xargs ps h --ppid | awk
> '{print $1}' | xargs`
> if [ "$CHILDPROCESSES" ]; then
> kill $CHILDPROCESSES
> fi
> fi
> start-stop-daemon --oknodo --stop -m --quiet --pidfile $PIDFILE
> $DAEMON
> rm -f $PIDFILE