On Tue, Nov 6, 2012 at 21:00:38 +0100, Salvatore Bonaccorso wrote: > diff -u couriergraph-0.25/debian/init couriergraph-0.25/debian/init > --- couriergraph-0.25/debian/init > +++ couriergraph-0.25/debian/init > @@ -14,7 +14,8 @@ > DESC="Courier login Statistics" > DAEMON=/usr/sbin/couriergraph.pl > > -PIDFILE=/var/run/servergraph/couriergraph.pid > +PIDDIR=/var/run/servergraph > +PIDFILE=$PIDDIR/couriergraph.pid > RRD_DIR=/var/lib/couriergraph > RRD_NAME=couriergraph > > @@ -23,14 +24,25 @@ > if [ -f $CONFIG ]; then > . $CONFIG > fi > - > + > +if [ ! -d $PIDDIR ]; then > + mkdir -p $PIDDIR > + chown daemon:root $PIDDIR > +fi > + > case "$1" in > start) > echo -n "Starting $DESC: " > - start-stop-daemon --start --quiet --pidfile $PIDFILE \ > - --exec $DAEMON -N 15 -c daemon:adm -- \ > - -l $MAIL_LOG -d --daemon_rrd=$RRD_DIR --rrd_name=$RRD_NAME > - echo "$NAME." > + # If pid file is present the daemon is probably running > + if [ -f "$PIDFILE" ]; then > + echo "already running." > + exit 1
This is broken. Leave that work to s-s-d, it's more likely to do it correctly. Though I guess that might not work with --exec $DAEMON, so you'll want to use --startas instead, and either change --exec to perl, or use --name. Also, --oknodo. > + else > + start-stop-daemon --start --quiet --pidfile $PIDFILE \ > + --exec $DAEMON -N 15 -c daemon:adm -- \ > + -l $MAIL_LOG -d --daemon_rrd=$RRD_DIR > --rrd_name=$RRD_NAME > + echo "$NAME." > + fi > ;; > > stop) Cheers, Julien
signature.asc
Description: Digital signature