mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-06 04:30:28 +00:00
add the ability to run an arbitrary command if asterisk crashes
(inspired by issue #7698, which was res_segfault by anthm) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@39636 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -5,6 +5,7 @@ CLIARGS="$*" # Grab any args passed to safe_asterisk
|
|||||||
TTY=9 # TTY (if you want one) for Asterisk to run on
|
TTY=9 # TTY (if you want one) for Asterisk to run on
|
||||||
CONSOLE=yes # Whether or not you want a console
|
CONSOLE=yes # Whether or not you want a console
|
||||||
#NOTIFY=ben@alkaloid.net # Who to notify about crashes
|
#NOTIFY=ben@alkaloid.net # Who to notify about crashes
|
||||||
|
#EXEC=/path/to/somescript # Run this command if Asterisk crashes
|
||||||
MACHINE=`hostname` # To specify which machine has crashed when getting the mail
|
MACHINE=`hostname` # To specify which machine has crashed when getting the mail
|
||||||
DUMPDROP=/tmp
|
DUMPDROP=/tmp
|
||||||
SLEEPSECS=4
|
SLEEPSECS=4
|
||||||
@@ -131,6 +132,9 @@ run_asterisk()
|
|||||||
echo "Asterisk on $MACHINE exited on signal $EXITSIGNAL. Might want to take a peek." | \
|
echo "Asterisk on $MACHINE exited on signal $EXITSIGNAL. Might want to take a peek." | \
|
||||||
mail -s "Asterisk Died" $NOTIFY
|
mail -s "Asterisk Died" $NOTIFY
|
||||||
fi
|
fi
|
||||||
|
if [ "$EXEC" != "" ]; then
|
||||||
|
$EXEC
|
||||||
|
fi
|
||||||
if [ -f /tmp/core ]; then
|
if [ -f /tmp/core ]; then
|
||||||
mv /tmp/core ${DUMPDROP}/core.`hostname`-`date -Iseconds` &
|
mv /tmp/core ${DUMPDROP}/core.`hostname`-`date -Iseconds` &
|
||||||
fi
|
fi
|
||||||
|
Reference in New Issue
Block a user