[asterisk-commits] tilghman: trunk r63906 - in /trunk: ./ Makefile contrib/scripts/safe_asterisk

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Fri May 11 09:37:16 MST 2007


Author: tilghman
Date: Fri May 11 11:37:16 2007
New Revision: 63906

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

................
r63905 | tilghman | 2007-05-11 11:35:51 -0500 (Fri, 11 May 2007) | 10 lines

Merged revisions 63903 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r63903 | tilghman | 2007-05-11 11:31:03 -0500 (Fri, 11 May 2007) | 2 lines

Issue 9121 - fixups for safe_asterisk script

........

................

Modified:
    trunk/   (props changed)
    trunk/Makefile
    trunk/contrib/scripts/safe_asterisk

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

Modified: trunk/Makefile
URL: http://svn.digium.com/view/asterisk/trunk/Makefile?view=diff&rev=63906&r1=63905&r2=63906
==============================================================================
--- trunk/Makefile (original)
+++ trunk/Makefile Fri May 11 11:37:16 2007
@@ -427,7 +427,7 @@
 	$(INSTALL) -m 755 contrib/scripts/astgenkey $(DESTDIR)$(ASTSBINDIR)/
 	$(INSTALL) -m 755 contrib/scripts/autosupport $(DESTDIR)$(ASTSBINDIR)/
 	if [ ! -f $(DESTDIR)$(ASTSBINDIR)/safe_asterisk ]; then \
-		cat contrib/scripts/safe_asterisk | sed 's|__ASTERISK_SBIN_DIR__|$(ASTSBINDIR)|;' > $(DESTDIR)$(ASTSBINDIR)/safe_asterisk ;\
+		cat contrib/scripts/safe_asterisk | sed 's|__ASTERISK_SBIN_DIR__|$(ASTSBINDIR)|;s|__ASTERISK_VARRUN_DIR__|$(ASTVARRUNDIR)|;' > $(DESTDIR)$(ASTSBINDIR)/safe_asterisk ;\
 		chmod 755 $(DESTDIR)$(ASTSBINDIR)/safe_asterisk;\
 	fi
 	$(INSTALL) -d $(DESTDIR)$(ASTHEADERDIR)

Modified: trunk/contrib/scripts/safe_asterisk
URL: http://svn.digium.com/view/asterisk/trunk/contrib/scripts/safe_asterisk?view=diff&rev=63906&r1=63905&r2=63906
==============================================================================
--- trunk/contrib/scripts/safe_asterisk (original)
+++ trunk/contrib/scripts/safe_asterisk Fri May 11 11:37:16 2007
@@ -10,6 +10,7 @@
 DUMPDROP=/tmp
 SLEEPSECS=4
 ASTSBINDIR=__ASTERISK_SBIN_DIR__
+ASTPIDFILE=__ASTERISK_VARRUN_DIR__/asterisk.pid
 
 # comment this line out to have this script _not_ kill all mpg123 processes when
 # asterisk exits
@@ -96,6 +97,11 @@
 fi
 
 #
+# Don't die if stdout/stderr can't be written to
+#
+trap '' SIGPIPE
+
+#
 # Run scripts to set any environment variables or do any other system-specific setup needed
 #
 
@@ -114,10 +120,10 @@
 		if [ "$TTY" != "" ]; then
 			cd /tmp
 			stty sane < /dev/${TTY}
-			nice -n $PRIORITY ${ASTSBINDIR}/asterisk ${CLIARGS} ${ASTARGS} >& /dev/${TTY} < /dev/${TTY}
+			nice -n $PRIORITY ${ASTSBINDIR}/asterisk -f ${CLIARGS} ${ASTARGS} >& /dev/${TTY} < /dev/${TTY}
 		else
 			cd /tmp
-			nice -n $PRIORITY ${ASTSBINDIR}/asterisk ${CLIARGS} ${ASTARGS}
+			nice -n $PRIORITY ${ASTSBINDIR}/asterisk -f ${CLIARGS} ${ASTARGS}
 		fi
 		EXITSTATUS=$?
 		echo "Asterisk ended with exit status $EXITSTATUS"
@@ -135,7 +141,11 @@
 			if [ "$EXEC" != "" ]; then
 				$EXEC
 			fi
-			if [ -f /tmp/core ]; then
+
+			PID=`cat ${ASTPIDFILE}`
+			if [ -f /tmp/core.${PID} ]; then
+				mv /tmp/core.${PID} ${DUMPDROP}/core.`hostname`-`date -Iseconds` &
+			elif [ -f /tmp/core ]; then
 				mv /tmp/core ${DUMPDROP}/core.`hostname`-`date -Iseconds` &
 			fi
 		else
@@ -144,7 +154,11 @@
 				exit 0
 			else
 				echo "Asterisk died with code $EXITSTATUS."
-				if [ -f /tmp/core ]; then
+
+				PID=`cat ${ASTPIDFILE}`
+				if [ -f /tmp/core.${PID} ]; then
+					mv /tmp/core.${PID} ${DUMPDROP}/core.`hostname`-`date -Iseconds` &
+				elif [ -f /tmp/core ]; then
 					mv /tmp/core ${DUMPDROP}/core.`hostname`-`date -Iseconds` &
 				fi
 			fi



More information about the asterisk-commits mailing list