Automatically start Asterisk at boot time

Networking
VoIP
Author

Vinh Nguyen

Published

November 30, 2010

Learned how to do so from this thread.

cd ~/Downloads/asterisk/1.8/contrib/init.d ## contrib folder is in source directory
sudo cp rc.debian.asterisk /etc/init.d/asterisk
sudo chmod 755 /etc/init.d/asterisk
# to set the script as boot
update-rc.d asterisk defaults

# to remove the script from boot
update-rc.d -f asterisk remove

Modify the /etc/init.d/asterisk:

# Full path to asterisk binary
## DAEMON=__ASTERISK_SBIN_DIR__/asterisk
DAEMON=/usr/sbin/asterisk
## ASTVARRUNDIR=__ASTERISK_VARRUN_DIR__
ASTVARRUNDIR=/var/run/asterisk/
## ASTETCDIR=__ASTERISK_ETC_DIR__
ASTETCDIR=/etc/asterisk/