bb85f6fc39
ok ian@
54 lines
1.7 KiB
Plaintext
54 lines
1.7 KiB
Plaintext
$OpenBSD: patch-contrib_scripts_safe_asterisk,v 1.5 2007/10/04 11:25:44 sthen Exp $
|
|
--- contrib/scripts/safe_asterisk.orig Thu Sep 20 22:01:20 2007
|
|
+++ contrib/scripts/safe_asterisk Wed Oct 3 21:15:26 2007
|
|
@@ -1,20 +1,21 @@
|
|
-#!/bin/bash
|
|
+#!/bin/sh
|
|
# vim:textwidth=80:tabstop=4:shiftwidth=4:smartindent:autoindent
|
|
|
|
CLIARGS="$*" # Grab any args passed to safe_asterisk
|
|
-TTY=9 # TTY (if you want one) for Asterisk to run on
|
|
-CONSOLE=yes # Whether or not you want a console
|
|
-#NOTIFY=ben@alkaloid.net # Who to notify about crashes
|
|
+TTY="" # TTY (if you want one) for Asterisk to run on
|
|
+CONSOLE=no # Whether or not you want a console
|
|
+NOTIFY=root # 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
|
|
DUMPDROP=/tmp
|
|
SLEEPSECS=4
|
|
ASTSBINDIR=__ASTERISK_SBIN_DIR__
|
|
ASTPIDFILE=__ASTERISK_VARRUN_DIR__/asterisk.pid
|
|
+VARRUNOWNER="_asterisk:wheel" # chown __ASTERISK_VARRUN_DIR__ if it's created.
|
|
|
|
-# comment this line out to have this script _not_ kill all mpg123 processes when
|
|
+# uncomment this line to have this script kill all mpg123 processes when
|
|
# asterisk exits
|
|
-KILLALLMPG123=1
|
|
+# KILLALLMPG123=1
|
|
|
|
# run asterisk with this priority
|
|
PRIORITY=0
|
|
@@ -66,6 +67,12 @@ else
|
|
# set the process's filemax to whatever set above
|
|
ulimit -n $MAXFILES
|
|
|
|
+ varrundir=`dirname $ASTPIDFILE`
|
|
+ if [ ! -d $varrundir ]; then
|
|
+ mkdir -p $varrundir
|
|
+ [ -n "$VARRUNOWNER" ] && chown $VARRUNOWNER $varrundir
|
|
+ chmod 770 $varrundir
|
|
+ fi
|
|
fi
|
|
|
|
#
|
|
@@ -167,7 +174,7 @@ run_asterisk()
|
|
sleep $SLEEPSECS
|
|
if [ $KILLALLMPG123 ]
|
|
then
|
|
- killall -9 mpg123
|
|
+ pkill -9 mpg123
|
|
fi
|
|
done
|
|
}
|