Tue 5 Sep 2006
Configure your inittab file to restart Asterisk automatically if it ever crashes.
This tutorial assumes you have root access and you are running your asterisk server as user “asterisk” instead of “root”.
- Configure your inittab file for asterisk.
[root@localhost]#vi /etc/inittab
.
.
.
5:2345:respawn:/sbin/mingetty tty5
6:2345:respawn:/sbin/mingetty tty6
ax:2345:respawn:/usr/sbin/asterisk -qf -U asterisk -G asterisk
.
. - Instruct init to re-read the inittab file.
[root@localhost]#init q - Now try to connect to the asterisk process.
[root@localhost]#asterisk -rYou should get the asterisk CLI at this point localhost*CLI> - In order to hard restart asterisk, use this command.
[root@localhost]#asterisk -rx “stop now” - In order to completely stop the asterisk process,
- You have to go back to step 1 and comment the asterisk line out.
- Then issue the ‘init q‘ command
- Then issue the ‘asterisk -rx “stop now‘ command


(4 votes, average: 3.5 out of 5)







July 7th, 2008 at 12:25 pm
Better to use safe_asterisk instead of this method, because it allows you to stop asterisk easily and also core dumps will be available without any further settings.
HTH
July 13th, 2008 at 1:22 am
@LR - You are right. Thank you.
Josh
August 2nd, 2008 at 4:15 pm
This is good to learn but why don’t you use Asterisk built-in init script? Well simple run this command “asterisk config” in the asterisk source directory and you are done. Now you can do “service asterisk stop/start” etc
August 2nd, 2008 at 9:23 pm
ssaud,
You are right. The init script in the asterisk source directory is now the correct way to do this. Thanks for the ‘asterisk config’ tip.
Josh