Skip to content
Snippets Groups Projects
Commit a4f5985b authored by Tilghman Lesher's avatar Tilghman Lesher
Browse files

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

........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@63906 65c4cc65-6c06-0410-ace0-fbb531ad65f3
parent 08d37d45
No related branches found
No related tags found
No related merge requests found
...@@ -427,7 +427,7 @@ bininstall: _all ...@@ -427,7 +427,7 @@ bininstall: _all
$(INSTALL) -m 755 contrib/scripts/astgenkey $(DESTDIR)$(ASTSBINDIR)/ $(INSTALL) -m 755 contrib/scripts/astgenkey $(DESTDIR)$(ASTSBINDIR)/
$(INSTALL) -m 755 contrib/scripts/autosupport $(DESTDIR)$(ASTSBINDIR)/ $(INSTALL) -m 755 contrib/scripts/autosupport $(DESTDIR)$(ASTSBINDIR)/
if [ ! -f $(DESTDIR)$(ASTSBINDIR)/safe_asterisk ]; then \ 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;\ chmod 755 $(DESTDIR)$(ASTSBINDIR)/safe_asterisk;\
fi fi
$(INSTALL) -d $(DESTDIR)$(ASTHEADERDIR) $(INSTALL) -d $(DESTDIR)$(ASTHEADERDIR)
......
...@@ -10,6 +10,7 @@ MACHINE=`hostname` # To specify which machine has crashed when getting the mai ...@@ -10,6 +10,7 @@ MACHINE=`hostname` # To specify which machine has crashed when getting the mai
DUMPDROP=/tmp DUMPDROP=/tmp
SLEEPSECS=4 SLEEPSECS=4
ASTSBINDIR=__ASTERISK_SBIN_DIR__ ASTSBINDIR=__ASTERISK_SBIN_DIR__
ASTPIDFILE=__ASTERISK_VARRUN_DIR__/asterisk.pid
# comment this line out to have this script _not_ kill all mpg123 processes when # comment this line out to have this script _not_ kill all mpg123 processes when
# asterisk exits # asterisk exits
...@@ -95,6 +96,11 @@ if [ ! -w ${DUMPDROP} ]; then ...@@ -95,6 +96,11 @@ if [ ! -w ${DUMPDROP} ]; then
exit 1 exit 1
fi 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 # Run scripts to set any environment variables or do any other system-specific setup needed
# #
...@@ -114,10 +120,10 @@ run_asterisk() ...@@ -114,10 +120,10 @@ run_asterisk()
if [ "$TTY" != "" ]; then if [ "$TTY" != "" ]; then
cd /tmp cd /tmp
stty sane < /dev/${TTY} 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 else
cd /tmp cd /tmp
nice -n $PRIORITY ${ASTSBINDIR}/asterisk ${CLIARGS} ${ASTARGS} nice -n $PRIORITY ${ASTSBINDIR}/asterisk -f ${CLIARGS} ${ASTARGS}
fi fi
EXITSTATUS=$? EXITSTATUS=$?
echo "Asterisk ended with exit status $EXITSTATUS" echo "Asterisk ended with exit status $EXITSTATUS"
...@@ -135,7 +141,11 @@ run_asterisk() ...@@ -135,7 +141,11 @@ run_asterisk()
if [ "$EXEC" != "" ]; then if [ "$EXEC" != "" ]; then
$EXEC $EXEC
fi 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` & mv /tmp/core ${DUMPDROP}/core.`hostname`-`date -Iseconds` &
fi fi
else else
...@@ -144,7 +154,11 @@ run_asterisk() ...@@ -144,7 +154,11 @@ run_asterisk()
exit 0 exit 0
else else
echo "Asterisk died with code $EXITSTATUS." 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` & mv /tmp/core ${DUMPDROP}/core.`hostname`-`date -Iseconds` &
fi fi
fi fi
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment