Index: contrib/scripts/safe_asterisk =================================================================== RCS file: /var/lib/cvs/asterisk/contrib/scripts/safe_asterisk,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 safe_asterisk --- contrib/scripts/safe_asterisk 15 Jan 2005 09:22:34 -0000 1.1.1.1 +++ contrib/scripts/safe_asterisk 13 Sep 2005 10:07:33 -0000 @@ -4,6 +4,14 @@ CONSOLE=yes # Whether or not you want a console #NOTIFY=ben@alkaloid.net # Who to notify about crashes DUMPDROP=/tmp + +# run asterisk with this priority +PRIORITY=-19 + +# maxiimum number of open files is set to the system maximum divided by two. +# FIXME: This is linux only. +MAXFILES=$(( `cat /proc/sys/fs/file-max` / 2 )) + # # Don't fork when running "safely" # @@ -32,6 +40,9 @@ # ulimit -c unlimited +# set the process's filemax to half the system filemax +ulimit -n $MAXFILES + #launch_asterisk() #{ #} @@ -43,10 +54,10 @@ if [ "$TTY" != "" ]; then cd /tmp stty sane < /dev/${TTY} - asterisk ${CLIARGS} ${ASTARGS} >& /dev/${TTY} < /dev/${TTY} + nice -n $PRIORITY asterisk ${CLIARGS} ${ASTARGS} >& /dev/${TTY} < /dev/${TTY} else cd /tmp - asterisk ${CLIARGS} ${ASTARGS} + nice -n $PRIORITY asterisk ${CLIARGS} ${ASTARGS} fi EXITSTATUS=$? echo "Asterisk ended with exit status $EXITSTATUS"