make use of pidof

This commit is contained in:
Jan Wagner 2008-04-14 18:44:22 +00:00
parent d26a0d55a0
commit fde3e09a70
3 changed files with 8 additions and 7 deletions

1
debian/changelog vendored
View file

@ -3,6 +3,7 @@ dns-flood-detector (1.12-3) UNREALESED; urgency=low
* added Vcs- fields, moved Homepage into source header's field
* bump standards version to 3.7.3
* change copyright of packaging to 2008 in debian/copyright
* get rid of 'ps aux' in init script and preinst, using pidof instead
-- Jan Wagner <waja@cyconet.org> Sun, 09 Dec 2007 22:48:23 +0100

12
debian/init.d vendored
View file

@ -35,7 +35,7 @@ case "$1" in
echo -n "Starting $DESC: "
start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \
--exec $DAEMON -- $DAEMON_OPTS
ps aux | grep $DAEMON | head -1 | awk '{ print $2 }' > /var/run/$NAME.pid
/bin/pidof $DAEMON > /var/run/$NAME.pid
echo "$NAME."
;;
stop)
@ -46,11 +46,11 @@ case "$1" in
;;
restart|force-reload)
echo -n "Restarting $DESC: "
start-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid \
--exec $DAEMON
start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \
--exec $DAEMON -- $DAEMON_OPTS
ps aux | grep $DAEMON | head -1 | awk '{ print $2 }' > /var/run/$NAME.pid
start-stop-daemon --stop --quiet --pidfile \
/var/run/$NAME.pid --exec $DAEMON
start-stop-daemon --start --quiet --pidfile \
/var/run/$NAME.pid --exec $DAEMON -- $DAEMON_OPTS
/bin/pidof $DAEMON > /var/run/$NAME.pid
echo "$NAME."
;;
*)

2
debian/preinst vendored
View file

@ -3,6 +3,6 @@ set -e
# generate correct pid file, for versions where was non or incorrect
if [ "$1" = "upgrade" ] && [ "$2" ] && dpkg --compare-versions "$2" <= "1.12-1"; then
ps aux | grep /usr/bin/dns-flood-detector | head -1 | awk '{ print $2 }' > /var/run/dns-flood-detector.pid
/bin/pidof dns-flood-detector > /var/run/dns-flood-detector.pid
fi
#DEBHELPER#