[svn-commits] tilghman: branch 1.2 r63903 - in /branches/1.2: ./
contrib/scripts/
svn-commits at lists.digium.com
svn-commits at lists.digium.com
Fri May 11 09:31:03 MST 2007
Author: tilghman
Date: Fri May 11 11:31:03 2007
New Revision: 63903
URL: http://svn.digium.com/view/asterisk?view=rev&rev=63903
Log:
Issue 9121 - fixups for safe_asterisk script
Modified:
branches/1.2/Makefile
branches/1.2/contrib/scripts/safe_asterisk
Modified: branches/1.2/Makefile
URL: http://svn.digium.com/view/asterisk/branches/1.2/Makefile?view=diff&rev=63903&r1=63902&r2=63903
==============================================================================
--- branches/1.2/Makefile (original)
+++ branches/1.2/Makefile Fri May 11 11:31:03 2007
@@ -658,7 +658,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: branches/1.2/contrib/scripts/safe_asterisk
URL: http://svn.digium.com/view/asterisk/branches/1.2/contrib/scripts/safe_asterisk?view=diff&rev=63903&r1=63902&r2=63903
==============================================================================
--- branches/1.2/contrib/scripts/safe_asterisk (original)
+++ branches/1.2/contrib/scripts/safe_asterisk Fri May 11 11:31:03 2007
@@ -6,6 +6,8 @@
MACHINE=`hostname` # To specify which machine has crashed when getting the mail
DUMPDROP=/tmp
ASTSBINDIR=__ASTERISK_SBIN_DIR__
+ASTPIDFILE=__ASTERISK_VARRUN_DIR__/asterisk.pid
+
#
# Don't fork when running "safely"
#
@@ -35,6 +37,11 @@
ulimit -c unlimited
#
+# 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
#
@@ -53,10 +60,10 @@
if [ "$TTY" != "" ]; then
cd /tmp
stty sane < /dev/${TTY}
- ${ASTSBINDIR}/asterisk ${CLIARGS} ${ASTARGS} >& /dev/${TTY} < /dev/${TTY}
+ ${ASTSBINDIR}/asterisk -f ${CLIARGS} ${ASTARGS} >& /dev/${TTY} < /dev/${TTY}
else
cd /tmp
- ${ASTSBINDIR}/asterisk ${CLIARGS} ${ASTARGS}
+ ${ASTSBINDIR}/asterisk -f ${CLIARGS} ${ASTARGS}
fi
EXITSTATUS=$?
echo "Asterisk ended with exit status $EXITSTATUS"
@@ -71,7 +78,11 @@
echo "Asterisk on $MACHINE exited on signal $EXITSIGNAL. Might want to take a peek." | \
mail -s "Asterisk Died" $NOTIFY
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
@@ -80,7 +91,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 svn-commits
mailing list