[Pkg-voip-commits] r4543 - in /asterisk/trunk/debian: asterisk.init changelog patches/safe_asterisk-nobg patches/series

paravoid at alioth.debian.org paravoid at alioth.debian.org
Fri Sep 21 05:38:27 UTC 2007


Author: paravoid
Date: Fri Sep 21 05:38:26 2007
New Revision: 4543

URL: http://svn.debian.org/wsvn/pkg-voip/?sc=1&rev=4543
Log:
* Fix init.d stop when using safe_asterisk. (Closes: #376514)

Added:
    asterisk/trunk/debian/patches/safe_asterisk-nobg
Modified:
    asterisk/trunk/debian/asterisk.init
    asterisk/trunk/debian/changelog
    asterisk/trunk/debian/patches/series

Modified: asterisk/trunk/debian/asterisk.init
URL: http://svn.debian.org/wsvn/pkg-voip/asterisk/trunk/debian/asterisk.init?rev=4543&op=diff
==============================================================================
--- asterisk/trunk/debian/asterisk.init (original)
+++ asterisk/trunk/debian/asterisk.init Fri Sep 21 05:38:26 2007
@@ -166,7 +166,8 @@
 			$CHDIR_PARM \
 			--exec $REALDAEMON -- $PARAMS
 	else
-		start-stop-daemon --start --group $GROUP --make-pidfile \
+		start-stop-daemon --start --group $GROUP \
+			--background --make-pidfile \
 			$CHDIR_PARM --pidfile "$ASTSAFE_PIDFILE" \
 			--exec $REALDAEMON -- $PARAMS
 	fi
@@ -175,23 +176,22 @@
 	echo "$NAME."
 	;;
   stop)
-	echo -n "Stopping $DESC: "
+	echo -n "Stopping $DESC: $NAME"
 	if [ "$RUNASTSAFE" = "yes" ];then
 		# hopefully this will work. Untested
-		$REALDAEMON -rx 'stop now' > /dev/null  || true
+		$DAEMON -rx 'stop now' > /dev/null  || true
+		## giving a small grace time to shut down cleanly.
+		#sleep 2 # you can add timeouts in the comma
+		start-stop-daemon --stop --quiet --oknodo \
+				  --pidfile $ASTSAFE_PIDFILE
+
+		rm -f $ASTSAFE_PIDFILE
 	else
 		# Try gracefully.
 		# this may hang in some cases. Specifically, when the asterisk
 		# processes is stopped. No bother to worry about cleanup: 
 		# it will either fail or die when asterisk dies.
 		( $DAEMON -rx 'stop now' > /dev/null 2>&1 & ) &
-	fi
-	echo -n "$NAME"
-	## giving a small grace time to shut down cleanly.
-	#sleep 2 # you can add timeouts in the comma
-	if [ "$RUNASTSAFE" = "yes" ];then
-		start-stop-daemon --quiet --pidfile $ASTSAFE_PIDFILE --oknodo \
-			--stop
 	fi
 	# just making sure it's really, really dead. 
 	# KILL is necessary just in case there's an asterisk -r in the background

Modified: asterisk/trunk/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-voip/asterisk/trunk/debian/changelog?rev=4543&op=diff
==============================================================================
--- asterisk/trunk/debian/changelog (original)
+++ asterisk/trunk/debian/changelog Fri Sep 21 05:38:26 2007
@@ -18,6 +18,7 @@
   * Don't use MAKEFLAGS as a variable in debian/rules since it has a special
     meaning for make. Reported by Simon Richter.
   * Add Homepage field, as supported by dpkg 1.14.6.
+  * Fix init.d stop when using safe_asterisk. (Closes: #376514)
 
   [ Kilian Krause ]
   * Add backport hook for Sarge. Update Dapper.
@@ -27,7 +28,7 @@
   [ Tzafrir Cohen ]
   * Support increasing open files limit from init.d script.
 
- -- Faidon Liambotis <paravoid at debian.org>  Thu, 20 Sep 2007 09:33:26 +0300
+ -- Faidon Liambotis <paravoid at debian.org>  Fri, 21 Sep 2007 08:35:42 +0300
 
 asterisk (1:1.4.11~dfsg-1) unstable; urgency=low
 

Added: asterisk/trunk/debian/patches/safe_asterisk-nobg
URL: http://svn.debian.org/wsvn/pkg-voip/asterisk/trunk/debian/patches/safe_asterisk-nobg?rev=4543&op=file
==============================================================================
--- asterisk/trunk/debian/patches/safe_asterisk-nobg (added)
+++ asterisk/trunk/debian/patches/safe_asterisk-nobg Fri Sep 21 05:38:26 2007
@@ -1,0 +1,31 @@
+Add an option to safe_asterisk so that it won't background.
+
+This is intended to work with start-stop-daemon's --background option which
+results in a correct pidfile since the process doesn't fork.
+
+#376514, #362281
+
+Should be forwarded upstream since it doesn't change known behavior
+when BACKGROUND=1.
+
+ -- Faidon Liambotis <paravoid at debian.org>
+--- asterisk-1.4.11~dfsg.orig/contrib/scripts/safe_asterisk
++++ asterisk-1.4.11~dfsg/contrib/scripts/safe_asterisk
+@@ -11,6 +11,7 @@ DUMPDROP=/tmp
+ SLEEPSECS=4
+ ASTSBINDIR=__ASTERISK_SBIN_DIR__
+ ASTPIDFILE=__ASTERISK_VARRUN_DIR__/asterisk.pid
++BACKGROUND=0
+ 
+ # comment this line out to have this script _not_ kill all mpg123 processes when
+ # asterisk exits
+@@ -172,4 +173,8 @@ run_asterisk()
+ 	done
+ }
+ 
+-run_asterisk &
++if [ "$BACKGROUND" = "1" ]; then
++	run_asterisk &
++else
++	run_asterisk
++fi

Modified: asterisk/trunk/debian/patches/series
URL: http://svn.debian.org/wsvn/pkg-voip/asterisk/trunk/debian/patches/series?rev=4543&op=diff
==============================================================================
--- asterisk/trunk/debian/patches/series (original)
+++ asterisk/trunk/debian/patches/series Fri Sep 21 05:38:26 2007
@@ -4,6 +4,7 @@
 astvarrundir
 ast_key_dir
 make-clean-fixes
+safe_asterisk-nobg
 h323-add-missing-ptrace-guard
 h323-no-deps-on-asterisk
 h323-workaround-openh323-segfault




More information about the Pkg-voip-commits mailing list