問題描述
系統重新啟動時自動啟動星號 (start asterisk autometically when system got restarted)
I have installed asterisk 1.4 on linux centOS 6.2. and I have also made entry to start asterisk in /etc/rc.local as /usr/bin/asterisk
. but it did not worked. When the system starts, it shows that asterisk service has started but actually it's not working i.e. command asterisk-vvvvr
does not work.
If I start the service manually after boot up the system, it works perfectly. can someone tell why asterisk is not working via rc.local file and I can start the asterisk automatically at system start up.
thanks in advance. PS: I have already tried a lot of methods by googling but there is still problem.
參考解法
方法 1:
To get a proper init script and enable asterisk to start automatically on boot: change to the asterisk source directory and do this:
make config
chkconfig asterisk on
after that you can reboot.
方法 2:
one subtle assumption here: to enable asterisk automatically on bootup, you have to be root and issue the command, ckhconfig (from olivecoder's steps)
$ sudo chkconfig asterisk on
- to verify that asterisk is indeed turned on, you should see something like
$ chkconfig |grep asterisk
asterisk 0:off 1:off 2:on 3:on 4:on 5:on 6:off
- to start the service w/o rebooting, you can try
$ sudo service asterisk start
- finally, to run the cli
$ sudo asterisk -rvvv
--- you should get something like this:
remus*CLI>
方法 3:
Just goto asterisk directory where you have all asterisk binaries and run below command.
In my case my asterisk binaries are at.
/usr/src/asterisk.
root@asterisk#
make config
方法 4:
SELinux can also be a problem.
See this Stackoverflow post here, which says:
If you have SELINUX enabled, it will prevent this file being created. You need to turn it off.
vi /etc/selinux/config
set SELINUX=disabled
reboot
(by Code Breaker、olivecoder、jack cardozo、user214393、nepdev)