Created
May 21, 2014 18:44
-
-
Save jsimpsoncd/767cca0a434829e1310c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
filemtime=`stat -c %Y /var/tmp/crashme.lock` | |
currmtime=`date +%s` | |
diffmtime=$(($currmtime - $filemtime)) | |
if [ $diffmtime -lt 600 ] | |
then | |
touch /var/tmp/crashme.lock | |
DATE=`date +%Y%m%d-%H%M` | |
LOG=/var/tmp/CRASHLOG-${DATE}.log | |
/bin/ps auxHww -L > ${LOG} | |
/usr/sbin/asterisk -rx 'core show locks' >> ${LOG} | |
/bin/kill -s SIGSEGV `cat /var/run/asterisk.pid` | |
/bin/echo "asterisk crashed. safe asterisk should restart it and kill mpg123 automatically" | |
else | |
echo "Existing lockfile, confirm that server has not been recently deleted and delete /var/tmp/crashme.lock" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment