diff options
author | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-05-11 16:37:16 +0000 |
---|---|---|
committer | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-05-11 16:37:16 +0000 |
commit | a87c65f96c385e4e620f8397fff95e8160712796 (patch) | |
tree | c63fa124edb8e5f9c0534de0b992dc4e1370c424 /contrib | |
parent | 9322f6b218085e2a50808903de1a5d52ad9a3974 (diff) |
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: http://svn.digium.com/svn/asterisk/trunk@63906 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/scripts/safe_asterisk | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/contrib/scripts/safe_asterisk b/contrib/scripts/safe_asterisk index 48fd14cd7..0464373a7 100644 --- a/contrib/scripts/safe_asterisk +++ b/contrib/scripts/safe_asterisk @@ -10,6 +10,7 @@ MACHINE=`hostname` # To specify which machine has crashed when getting the mai 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 @@ if [ ! -w ${DUMPDROP} ]; then 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 @@ run_asterisk() 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 @@ run_asterisk() 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 @@ run_asterisk() 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 |