Auto start Asterisk

1,884 views
Skip to first unread message

Armghan Shahid

unread,
Jun 29, 2009, 1:49:52 PM6/29/09
to Asterisk Professionals Pakistan
A-O-A
Any body remember how to automatically start asterisk when OS starts
and asterisk is not yet in /etc/init.d/
I am installing it from scratch

Mudasir Mirza

unread,
Jun 29, 2009, 6:17:53 PM6/29/09
to Asterisk Professionals Pakistan
Walaikum as salam,

Use /etc/rc.local

Put the exact command that you use to start asterisk in /etc/rc.local

Lal Kumar

unread,
Jun 30, 2009, 3:07:47 AM6/30/09
to asterisk-profes...@googlegroups.com

1st put the script in the /etc/init.d/ folder

and then run the following command which will enable the script to run
automatically when system boots up.

(RH) chkconfig asterisk on
(Ubuntu) update-rc.d asterisk defaults
--
Lal Kumar Lakhwani
Senior Networks Engineer
Emergen Consulting Pvt Ltd
F-8/1 Hatim Alvi Road Near
Mohatta Place, Clifton
Block-4, Karachi - 75330
Tel: (+92.21) 5290381-3
Fax: (+92.21) 5867578
IAX2: iph...@asterisk.emergen.biz/s
http://www.emergen.biz


Faraz Khan

unread,
Jun 30, 2009, 7:39:48 AM6/30/09
to asterisk-profes...@googlegroups.com
You can find the relevant RC scripts in the asterisk source directory
(under contrib/init.d I think)

On Tue, 2009-06-30 at 13:07 +0600, Lal Kumar wrote:
>
> 1st put the script in the /etc/init.d/ folder
>
> and then run the following command which will enable the script to run
> automatically when system boots up.
>
> (RH) chkconfig asterisk on
> (Ubuntu) update-rc.d asterisk defaults
>
>
> On Mon, 2009-06-29 at 15:17 -0700, Mudasir Mirza wrote:
> > Walaikum as salam,
> >
> > Use /etc/rc.local
> >
> > Put the exact command that you use to start asterisk in /etc/rc.local
> >
> > On Jun 29, 10:49 pm, Armghan Shahid <armg...@gmail.com> wrote:
> > > A-O-A
> > > Any body remember how to automatically start asterisk when OS starts
> > > and asterisk is not yet in /etc/init.d/
> > > I am installing it from scratch
> > >
> >
--

Faraz R Khan
Chief Architect
Emergen Consulting Pvt. Ltd.
+92.21.529.0381(3 lines) x200
www.emergen.biz

Haroon Hashmi

unread,
Jun 30, 2009, 9:18:09 AM6/30/09
to asterisk-profes...@googlegroups.com
Simple, follow these commands:


cp (Asterisk Source)/contrib/init/rc.debian.XXX /etc/init.c/asterisk

then edit your rc.local as:

nano /etc/rc.local

add(/etc/init.d/asterisk start)

add the path before exit 0

save and exit.

its done !!!
--
Syed Haroon Hashmi
Cell No. 92.321.8752757

Armghan Shahid

unread,
Jun 30, 2009, 10:23:48 AM6/30/09
to Asterisk Professionals Pakistan
Thanks for the reply
But I think there is something else missing
Following is the output of my command
==========================================================
root@astus:~# update-rc.d asterisk defaults
update-rc.d: warning: /etc/init.d/asterisk missing LSB style header
Adding system startup for /etc/init.d/asterisk ...
/etc/rc0.d/K20asterisk -> ../init.d/asterisk
/etc/rc1.d/K20asterisk -> ../init.d/asterisk
/etc/rc6.d/K20asterisk -> ../init.d/asterisk
/etc/rc2.d/S20asterisk -> ../init.d/asterisk
/etc/rc3.d/S20asterisk -> ../init.d/asterisk
/etc/rc4.d/S20asterisk -> ../init.d/asterisk
/etc/rc5.d/S20asterisk -> ../init.d/asterisk

The file exist in /etc/init.d/ folder
===============================================================
root@astus:~# ls /etc/init.d/
/etc/init.d/:
README keyboard-setup mysql
rmnologin
asterisk killnash mysql-ndb
sendsigs
bootlogd killprocs mysql-ndb-mgm
single
bootmisc.sh klogd networking
skeleton
checkfs.sh loopback pppd-dns ssh
checkroot.sh module-init-tools pptpd stop-
bootlogd
console-screen.kbd.sh mountall-bootclean.sh procps stop-
bootlogd-single
console-setup mountall.sh quota
sysklogd
denyhosts mountdevsubfs.sh quotarpc udev
glibc.sh mountkernfs.sh rc udev-
finish
halt mountnfs-bootclean.sh rc.debian.asterisk
umountfs
hostname.sh mountnfs.sh rc.local
umountnfs.sh
hwclock.sh mountoverflowtmp rcS
umountroot
hwclockfirst.sh mtab.sh reboot
urandom

But when I start it manually there is no issue
===============================================================
root@astus:~# /etc/init.d/asterisk start
* Starting Asterisk PBX: asterisk
...done.
root@astus:~#

Faraz Khan

unread,
Jul 1, 2009, 7:01:38 AM7/1/09
to asterisk-profes...@googlegroups.com
Is this on debian / ubuntu?
Emergen Consulting Pvt Ltd
+92.21.529.0381 x200
www.emergen.biz

Armghan Shahid

unread,
Jul 1, 2009, 7:58:18 AM7/1/09
to asterisk-profes...@googlegroups.com
Sir this is on ubuntu server
In fect its a virtual server
--
Armghan Shahid
Royal Horizan Pakistan
Phone: 0321 4014104

Shaheryar S. Sheikh

unread,
Jul 20, 2009, 7:25:32 AM7/20/09
to Asterisk Professionals Pakistan
Its pretty simple.

Step 1:
======
Copy rc.XXX.asterisk script (replace XXX with your destro name, e.g.
debian, suse or redhat) from <asterisk-sources>/contrib/init.d to /etc/
init.d. If file for your destro does not exist them use closest Linux
class your destro belongs too. For example for CentOS you should you
redhat, for Ubuntu you should use debian etc.etc.

E.g.,

cp <asterisk-sources>/contrib/init.d/rc.debian.asterisk /etc/init.d/
asterisk


Step 2:
======
Then add this service to current OS run-level.

For RPM Class Linux systems (Redhat, CentOS etc.)
chkconfig --level 35 asterisk on

For DEB Class Linux systems (Debian, Ubuntu etc.)
update-rc.d asterisk defaults

For Gentoo Class Linux systems (gentoo etc.)
rc-update add asterisk default

Thank you.
Reply all
Reply to author
Forward
0 new messages