[asterisk-commits] tilghman: trunk r115286 - in /trunk: ./ contrib/init.d/ contrib/scripts/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sun May 4 22:25:35 CDT 2008


Author: tilghman
Date: Sun May  4 22:25:35 2008
New Revision: 115286

URL: http://svn.digium.com/view/asterisk?view=rev&rev=115286
Log:
Merged revisions 115285 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r115285 | tilghman | 2008-05-04 22:22:25 -0500 (Sun, 04 May 2008) | 7 lines

When starting Asterisk, bug out if Asterisk is already running.
(closes issue #12525)
 Reported by: explidous
 Patches: 
       20080428__bug12525.diff.txt uploaded by Corydon76 (license 14)
 Tested by: mvanbaak

........

Modified:
    trunk/   (props changed)
    trunk/contrib/init.d/rc.debian.asterisk
    trunk/contrib/init.d/rc.gentoo.asterisk
    trunk/contrib/init.d/rc.mandrake.asterisk
    trunk/contrib/init.d/rc.redhat.asterisk
    trunk/contrib/init.d/rc.slackware.asterisk
    trunk/contrib/init.d/rc.suse.asterisk
    trunk/contrib/scripts/safe_asterisk

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Modified: trunk/contrib/init.d/rc.debian.asterisk
URL: http://svn.digium.com/view/asterisk/trunk/contrib/init.d/rc.debian.asterisk?view=diff&rev=115286&r1=115285&r2=115286
==============================================================================
--- trunk/contrib/init.d/rc.debian.asterisk (original)
+++ trunk/contrib/init.d/rc.debian.asterisk Sun May  4 22:25:35 2008
@@ -51,6 +51,14 @@
 
 case "$1" in
   start)
+	# Check if Asterisk is already running.  If it is, then bug out, because
+	# starting up Asterisk when Asterisk is already running is very bad.
+	VERSION=`${ASTSBINDIR}/asterisk -rx 'core show version'`
+	if [ "${VERSION:0:8}" = "Asterisk" ]; then # otherwise "Unable t"
+		echo "Asterisk is already running.  $0 will exit now."
+		exit 1
+	fi
+
 	log_begin_msg "Starting $DESC: $NAME"
         if [ $AST_USER ] ; then
                 ASTARGS="-U $AST_USER"

Modified: trunk/contrib/init.d/rc.gentoo.asterisk
URL: http://svn.digium.com/view/asterisk/trunk/contrib/init.d/rc.gentoo.asterisk?view=diff&rev=115286&r1=115285&r2=115286
==============================================================================
--- trunk/contrib/init.d/rc.gentoo.asterisk (original)
+++ trunk/contrib/init.d/rc.gentoo.asterisk Sun May  4 22:25:35 2008
@@ -6,6 +6,14 @@
 }
 
 start() {
+	# Check if Asterisk is already running.  If it is, then bug out, because
+	# starting safe_asterisk when Asterisk is running is very bad.
+	VERSION=`${ASTSBINDIR}/asterisk -rx 'core show version'`
+	if [ "${VERSION:0:8}" = "Asterisk" ]; then # otherwise "Unable t"
+		echo "Asterisk is already running.  $0 will exit now."
+		exit 1
+	fi
+
 	ebegin "Starting Asterisk"
 	/usr/sbin/asterisk
 	eend $? "Failed to start Asterisk"

Modified: trunk/contrib/init.d/rc.mandrake.asterisk
URL: http://svn.digium.com/view/asterisk/trunk/contrib/init.d/rc.mandrake.asterisk?view=diff&rev=115286&r1=115285&r2=115286
==============================================================================
--- trunk/contrib/init.d/rc.mandrake.asterisk (original)
+++ trunk/contrib/init.d/rc.mandrake.asterisk Sun May  4 22:25:35 2008
@@ -119,6 +119,14 @@
 
 case "$1" in
 	start)
+		# Check if Asterisk is already running.  If it is, then bug out, because
+		# starting Asterisk when Asterisk is already running is very bad.
+		VERSION=`${ASTSBINDIR}/asterisk -rx 'core show version'`
+		if [ "${VERSION:0:8}" = "Asterisk" ]; then # otherwise "Unable t"
+			echo "Asterisk is already running.  $0 will exit now."
+			exit 1
+		fi
+
 		gprintf "Starting asterisk: "
 		run_asterisk >/dev/null 2>&1 &
 		sleep 2	# Give it time to die

Modified: trunk/contrib/init.d/rc.redhat.asterisk
URL: http://svn.digium.com/view/asterisk/trunk/contrib/init.d/rc.redhat.asterisk?view=diff&rev=115286&r1=115285&r2=115286
==============================================================================
--- trunk/contrib/init.d/rc.redhat.asterisk (original)
+++ trunk/contrib/init.d/rc.redhat.asterisk Sun May  4 22:25:35 2008
@@ -68,6 +68,14 @@
 RETVAL=0
 
 start() {
+	# Check if Asterisk is already running.  If it is, then bug out, because
+	# starting safe_asterisk when Asterisk is running is very bad.
+	VERSION=`${AST_SBIN}/asterisk -rx 'core show version'`
+	if [ "${VERSION:0:8}" = "Asterisk" ]; then # otherwise "Unable t"
+		echo "Asterisk is already running."
+		exit 1
+	fi
+
 	# Start daemons.
 	echo -n $"Starting asterisk: "
         if [ -f $SAFE_ASTERISK ] ; then

Modified: trunk/contrib/init.d/rc.slackware.asterisk
URL: http://svn.digium.com/view/asterisk/trunk/contrib/init.d/rc.slackware.asterisk?view=diff&rev=115286&r1=115285&r2=115286
==============================================================================
--- trunk/contrib/init.d/rc.slackware.asterisk (original)
+++ trunk/contrib/init.d/rc.slackware.asterisk Sun May  4 22:25:35 2008
@@ -10,6 +10,14 @@
 
 asterisk_start() {
    if [ -x /usr/sbin/asterisk ]; then
+      # Check if Asterisk is already running.  If it is, then bug out, because
+      # starting safe_asterisk when Asterisk is running is very bad.
+      VERSION=`/usr/sbin/asterisk -rx 'core show version'`
+      if [ "${VERSION:0:8}" = "Asterisk" ]; then # otherwise "Unable t"
+         echo "Asterisk is already running.  $0 will exit now."
+         exit 1
+      fi
+
       echo "Starting Asterisk   /usr/sbin/asterisk"
       /usr/sbin/asterisk
    fi

Modified: trunk/contrib/init.d/rc.suse.asterisk
URL: http://svn.digium.com/view/asterisk/trunk/contrib/init.d/rc.suse.asterisk?view=diff&rev=115286&r1=115285&r2=115286
==============================================================================
--- trunk/contrib/init.d/rc.suse.asterisk (original)
+++ trunk/contrib/init.d/rc.suse.asterisk Sun May  4 22:25:35 2008
@@ -63,6 +63,15 @@
 
 start() {
 	# Start daemons.
+
+	# Check if Asterisk is already running.  If it is, then bug out, because
+	# starting Asterisk when Asterisk is already running is very bad.
+	VERSION=`/usr/sbin/asterisk -rx 'core show version'`
+	if [ "${VERSION:0:8}" = "Asterisk" ]; then # otherwise "Unable t"
+		echo "Asterisk is already running.  $0 will exit now."
+		exit 1
+	fi
+
 	echo -n $"Starting asterisk: "
         if [ -f $SAFE_ASTERISK ] ; then
 		DAEMON=$SAFE_ASTERISK

Modified: trunk/contrib/scripts/safe_asterisk
URL: http://svn.digium.com/view/asterisk/trunk/contrib/scripts/safe_asterisk?view=diff&rev=115286&r1=115285&r2=115286
==============================================================================
--- trunk/contrib/scripts/safe_asterisk (original)
+++ trunk/contrib/scripts/safe_asterisk Sun May  4 22:25:35 2008
@@ -37,6 +37,14 @@
 	    echo "safe_asterisk[$$]: $1" >> "$LOGFILE"
 	fi
 }
+
+# Check if Asterisk is already running.  If it is, then bug out, because
+# starting safe_asterisk when Asterisk is running is very bad.
+VERSION=`${ASTSBINDIR}/asterisk -rx 'core show version'`
+if [ "${VERSION:0:8}" = "Asterisk" ]; then # otherwise "Unable t"
+	message "Asterisk is already running.  $0 will exit now."
+	exit 1
+fi
 
 # since we're going to change priority and open files limits, we need to be
 # root. if running asterisk as other users, pass that to asterisk on the command




More information about the asterisk-commits mailing list