Newbie: how to auto start asterisk when system reboot

Hello there,

I am afriad to mess up with the /etc/inittab file since I am not a linux guru.
Is there an easy way to configure asterisk to make it start itself on every reboot?

Thx,
David

if you’re really not sure, you could add the appropriate line(s) to /etc/rc.d/rc.local

actually i just find the the easiest way is
Add the following line to /etc/inittab:
as:2:respawn:/usr/sbin/asterisk -f

it works in my debian system.

see more in the link below
http://www.voip-info.org/wiki-Asterisk+Starting+and+Stopping

actually i just find the the easiest way is
Add the following line to /etc/inittab:
as:2:respawn:/usr/sbin/asterisk -f

Good morning, xaiojun75.

I’m not so sure you want to do that. You want to make sure all of the device drivers (zaptel or ??) are loaded before you start Asterisk. Putting a startup line in the inittab probably doesn’t guarantee that.

The easiest way to do it that guarantees that all necessary drivers and daemons are running ahead of time is to put something like this in your /etc/rc.d/rc.local file:

/etc/rc.d/init.d/asterisk start

That’s how it’s done in Fedora Core and other Red Hat-like distros. With Debian and other distros you’ll have to verify that that’s how things get started in your system.

Executing “/etc/rc.d/init.d/asterisk start” starts up Asterisk using the /usr/sbin/safe_asterisk script, which takes care of things like restarting Asterisk if it should crash (same thing that “respawn” is for your inittab line though I’m not sure it will work as intended).

if you are running a redhat derivitave (redhat/centos/fedora) system:

in asterisk source dir, do 'make config’
then chkconfig --add asterisk

asterisk will start on system boot and can be controlled with ‘service asterisk (start/stop/restart)’

this may work on other distros

in Debian i do entries in /etc/rc2.d /etc/rc0.d and /etc/rc6.d entries are linked to .etc/init.d/asterisk.sh script
asterisk.sh start do /usr/sbin/asterisk
asterisk stop do asterisk -rx "stop gracefully"
that do starting/stopping when system is started, stopped or rebooted