Auto-Restart Asterisk automatically if it crashes

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”.

  1. 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
.
.

  1. Instruct init to re-read the inittab file.
    [root@localhost]#init q
  2. Now try to connect to the asterisk process.
    [root@localhost]#asterisk -r
    You should get the asterisk CLI at this pointlocalhost*CLI>
  3. In order to hard restart asterisk, use this command.
    [root@localhost]#asterisk -rx “stop now”
  4. 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

Read More: ahsantasneem.blogspot.com/2011/1 … erisk.html