Hi Team,

On 06/19/2010 11:51 AM, Adam D. Barratt wrote:
> Hi,
> 
> I've been reviewing the few remaining packages in s-p-u in preparation
> for the upcoming point release and had a couple of comments / queries on
> your "mon" upload.
> 
> -     echo -n "Starting $DESC: "
> -     start-stop-daemon --start --quiet --pidfile $PIDFILE --chuid $USER 
> --group $GROUP --exec $DAEMON -- $DAEMON_OPTS
> -     echo "$NAME."
> +     if [ -f $PIDFILE ] ; then
> +             echo "$NAME daemon is already running." 
> +     else
> +             echo -n "Starting $DESC: "
> +             start-stop-daemon --start --oknodo --pidfile $PIDFILE --chuid 
> $USER --group $GROUP --exec $DAEMON -- $DAEMON_OPTS
> +             echo "$NAME."
> +     fi
> 
> This looks like it should work, but would simply running the
> "start-stop-daemon --start --oknodo" call in all cases not work, given
> that it uses the pid file?
> 
> The "restart" section, on the other hand, is still not policy compliant:
> 
> restart)
> -    echo -n "Restarting $DESC: "
> -     start-stop-daemon --stop --quiet --pidfile $PIDFILE 
> -     sleep 1
> -     start-stop-daemon --start --quiet --pidfile $PIDFILE --chuid $USER 
> --group $GROUP --exec $DAEMON -- $DAEMON_OPTS
> -     echo "$NAME."
> +     if [ -f $PIDFILE ] ; then
> +     echo -n "Restarting $DESC: "
> +             start-stop-daemon --stop --quiet --pidfile $PIDFILE 
> +             sleep 1
> +             start-stop-daemon --start --quiet --pidfile $PIDFILE --chuid 
> $USER --group $GROUP --exec $DAEMON -- $DAEMON_OPTS
> +             echo "$NAME."
> +     else
> +             echo "$NAME daemon is not running."     
> +             echo "To start $NAME run: /etc/init.d/mon start"        
> +     fi
> 
> Policy 9.3.2 says:
> 
>     `restart'
>           stop and restart the service if it's already running, otherwise
>           start the service
> 
> which your updated script does not fulfil (specifically the "otherwise
> start the service" section).
> 
> For future reference, it would be appreciated if you could send a mail
> containing a debdiff and a brief explanation of the changes you'd like
> to make to [email protected] and wait for an ok, rather
> than uploading directly to s-p-u; this allows us to review the patch and
> makes it easier to incorporate any required changes.
> 
> Regards,
> 
> Adam

Sorry, that was my first s-p-u upload :(

As suggested, I'm sending this email to debian-release with the debdiff 
attached.

The script seems to be Policy compliant now.

I keep on waiting for the OK to upload this new version.

Sorry for the inconvenience

Cheers

-- 
 Dario Minnucci <[email protected]>
 Phone: +34 902021030 | Fax: +34 902024417
 Key fingerprint = BAA1 7AAF B21D 6567 D457  D67D A82F BB83 F3D5 7033

diff -u mon-0.99.2/debian/mon.init.d mon-0.99.2/debian/mon.init.d
--- mon-0.99.2/debian/mon.init.d
+++ mon-0.99.2/debian/mon.init.d
@@ -44,16 +44,30 @@
 
 set -e
 
-case "$1" in
-  start)
+
+function start_deamon {
 	echo -n "Starting $DESC: "
-	start-stop-daemon --start --quiet --pidfile $PIDFILE --chuid $USER --group $GROUP --exec $DAEMON -- $DAEMON_OPTS
+	start-stop-daemon --start --oknodo --pidfile $PIDFILE --chuid $USER --group $GROUP --exec $DAEMON -- $DAEMON_OPTS
 	echo "$NAME."
-	;;
-  stop)
+}
+function stop_daemon {
 	echo -n "Stopping $DESC: "
-	start-stop-daemon --stop --quiet --pidfile $PIDFILE 
+	start-stop-daemon --stop --oknodo --pidfile $PIDFILE 
 	echo "$NAME."
+}
+
+
+
+case "$1" in
+  start)
+	if [ -f $PIDFILE ] ; then
+		echo "$NAME daemon is already running."	
+	else
+		start_deamon
+	fi
+	;;
+  stop)
+		stop_daemon
 	;;
   #reload)
 	#
@@ -80,11 +94,14 @@
 	|| exit 0
 	;;
   restart)
-    echo -n "Restarting $DESC: "
-	start-stop-daemon --stop --quiet --pidfile $PIDFILE 
-	sleep 1
-	start-stop-daemon --start --quiet --pidfile $PIDFILE --chuid $USER --group $GROUP --exec $DAEMON -- $DAEMON_OPTS
-	echo "$NAME."
+	if [ -f $PIDFILE ] ; then
+		stop_daemon
+		sleep 1
+		start_deamon
+	else
+		echo "$NAME daemon is not running."	
+		start_deamon
+	fi
 	;;
   *)
 	N=/etc/init.d/$NAME
diff -u mon-0.99.2/debian/changelog mon-0.99.2/debian/changelog
--- mon-0.99.2/debian/changelog
+++ mon-0.99.2/debian/changelog
@@ -1,3 +1,10 @@
+mon (0.99.2-13+lenny1) stable-proposed-updates; urgency=low
+
+  * debian/mon.init.d: Script fixes to return success when daemon 
+    is restarted but is already running. (Closes: #538133)
+
+ -- Dario Minnucci <[email protected]>  Sun, 18 Jul 2010 17:09:04 +0200
+
 mon (0.99.2-13) unstable; urgency=low
 
   * debian/control: Conforms with latest Standards Version 3.8.0

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to