From fde3e09a70780327954fa6cbfb9f61e5d12cfb6f Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Mon, 14 Apr 2008 18:44:22 +0000 Subject: [PATCH] make use of pidof --- debian/changelog | 1 + debian/init.d | 12 ++++++------ debian/preinst | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/debian/changelog b/debian/changelog index 79c7675..81d4d7b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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 Sun, 09 Dec 2007 22:48:23 +0100 diff --git a/debian/init.d b/debian/init.d index 4feeaee..5783cd6 100644 --- a/debian/init.d +++ b/debian/init.d @@ -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." ;; *) diff --git a/debian/preinst b/debian/preinst index f803aee..70d2b78 100755 --- a/debian/preinst +++ b/debian/preinst @@ -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#