safe_asterisk / init.d
An init.d script to stop and start safe_asterisk started asterisk. If
asterisk is not stopped in 5 seconds, it is forcibly killed.
# wget http://wjd.nu/files/2012/04/safe_asterisk-init.d -O/etc/init.d/asterisk ; chmod 755 /etc/init.d/asterisk
Also possibly useful, the changes I made to safe_asterisk on a machine
where:
- there wasn’t a 
ttyleft to spam output on, rootis configured in/etc/aliasesto a sane destination,/var/spool/asteriskis the asterisk user homedir anyway, and,- attempting to set maxfiles to the highest value possible, wasn’t allowed.
 
#TTY=9
CONSOLE=no
NOTIFY=root
DUMPDROP=/var/spool/asterisk
MAXFILES=12288
...
run_asterisk >/dev/null 2>&1 &