On Tue, 2003-08-05 at 11:34, Celso González wrote: 
> I have filled a ITP a few days ago and now i have a preliminary package 
> (lintian & linda ok) available in
> http://bulmalug.net/~perroverde/debian

The init script is kinda broken, see the attached patch.


-- 
Earthling Michel Dänzer   \  Debian (powerpc), XFree86 and DRI developer
Software libre enthusiast  \     http://svcs.affero.net/rm.php?r=daenzer
--- /home/michdaen/debian/cpudyn-0.4.3/debian/cpudyn.init       2003-08-05 
16:59:41.000000000 +0200
+++ /etc/init.d/cpudyn  2003-08-05 22:41:42.000000000 +0200
@@ -8,46 +8,46 @@
 #
 
 PATH=/sbin:/bin:/usr/sbin:/usr/bin
-DAEMON=/usr/sbin/cpudyn
+DAEMON=/usr/sbin/cpudynd
 NAME=cpudyn
 DESC=cpudyn
 CONFFILE=/etc/cpudyn.conf
+PIDFILE=/var/run/$NAME.pid
 
 test -x $DAEMON || exit 0
-test -x $CONFFILE || exit 0
+test -e $CONFFILE || exit 0
 
 # Read the configuration file
-. /etc/cpudyn.conf
+. $CONFFILE
 
-# Load the default location of the slapd config file
-if [ -z "$TIMEOUT" ]; then
-       OPTS="-d -i $INTERVAL -p $CPU_UP $CPU_DOWN -t $TIMEOUT -h $DISKS"
-else
-       OPTS="-d -i $INTERVAL -p $CPU_UP $CPU_DOWN"
-fi
+OPTS=""
+if [ ! -z "$INTERVAL" ]; then OPTS="$OPTS -i $INTERVAL"; fi
+if [ ! -z "$CPU_UP" -a ! -z "$CPU_DOWN" ]; then OPTS="$OPTS -p $CPU_UP $CPU_DOWN"; fi
+if [ ! -z "$TIMEOUT" ]; then OPTS="$OPTS -t $TIMEOUT"; fi
+if [ ! -z "$DISKS" ]; then OPTS="$OPTS -h $DISKS"; fi
 
 set -e
 
 case "$1" in
   start)
        echo -n "Starting $DESC: "
-       start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \
-               --exec $DAEMON -- $OPTS
+       start-stop-daemon --start --quiet --pidfile $PIDFILE \
+               --background --make-pidfile --exec $DAEMON -- $OPTS
        echo "$NAME."
        ;;
   stop)
        echo -n "Stopping $DESC: "
-       start-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid \
-               --exec $DAEMON
+       start-stop-daemon --stop --quiet --pidfile $PIDFILE \
+               --exec $DAEMON && rm -f $PIDFILE
        echo "$NAME."
        ;;
   restart|force-reload)
        echo -n "Restarting $DESC: "
-       start-stop-daemon --stop --quiet --pidfile \
-               /var/run/$NAME.pid --exec $DAEMON
+       start-stop-daemon --stop --quiet --pidfile $PIDFILE \
+               --exec $DAEMON && rm -f $PIDFILE
        sleep 1
-       start-stop-daemon --start --quiet --pidfile \
-               /var/run/$NAME.pid --exec $DAEMON
+       start-stop-daemon --start --quiet --pidfile $PIDFILE \
+               --background --make-pidfile --exec $DAEMON -- $OPTS
        echo "$NAME."
        ;;
   *)

Reply via email to