root@localhost /etc/init.d# vim asterisk #!/bin/sh # # This file shoud be located in your init.d directory (e.g. /etc/rc.d/init.d). # From there you should make symbolic links in your rc#.d dirs to this file, # Typically rc2.d or rc3.d is used in /etc/rc.d/rc#.d/ or /etc/rc#.d # # Symbolic links are made like this: # cd /etc/rc.d/rc3.d # ln -s ../init.d/asterisk S99asterisk # case "$1" in start) echo "Starting Asterisk PBX system: " /usr/sbin/safe_asterisk ;; stop) echo "Try to shut down Asterisk PBX System: " /usr/sbin/asterisk -rx "stop gracefully" ;; stopnow) echo "Force shut down Asterisk PBX System: " /usr/sbin/asterisk -rx "stop when convenient" ;; *) echo "Usage: rlfck {start|stop|stopnow}" exit 1 esac exit 0