Asterisk is already in chkconfig . and its in on state from 2-5. But its not running on startup… I have written a custom shell script to run asterisk. The asterisk command not working (no error showing such as command not found etc). if the the same script run manually after startup it work properly…
Asterisk 16 now supports systemd, so you may want to try/check out the contrib/systemd directory (instead of using the old-style SysV/chkconfig scripts). There is a README.txt file in there that you should read (and then figure out only which other scripts you need, depending on your needs/implementation), but here are some example commands you may want to run:
Disable System V Init:
service asterisk stop
chkconfig --del asterisk
rm /etc/init.d/asterisk
Well, I apologize in advance if I can’t help you in more debt. I’m currently testing with Asterisk 16 installed on CentOS 7.6 (& I actually skipped over Asterisk 13 entirely).
If chkconfig --list shows that run-levels 2-5 are enabled for the asterisk process, then I suggest that you try replacing your “custom shell script” by the default one that asterisk provides (/etc/init.d/asterisk). In doing so, please make sure the following 2 default files are present:
/usr/sbin/asterisk
/usr/sbin/safe_asterisk
If you find that it works with default scripts then you know it’s a problem with your start up script (e.g.: Perhaps you did not write the start() function, required at boot time, whilst when you manually start it you are using “service asterisk restart”).
(Note: I will assume the rest of you installation is generic and correct. I’m also thinking that defaults should at least get Asterisk up and running, with the above.)
Thank you David. I have edited my post (changing binaries to now be simply files) to correct. I did notice that in the past, but in replying I did not even open/look at /usr/sbin/safe_asterisk as it’s contents were unimportant. My suggestion is still relevant. The key is to try the default setup files to see if that works, in order to determine if the issue is with vimals “custom shell script” or with the setup.
I have a custom script to run the asterisk as well as the php script for the AMI handling. But issue is not script not running, while the script is not running on boot up.
If the same script manually run after boot up. It works fine. The default asterisk initializing script even not working.
I tried another by new line to /etc/rc.local
/usr/sbin/asterisk
also tried
asterisk
but none of them running the asterisk. So I think that its not issue with the script
Agree’d. I think you’ve proven that both your custom script and the default Asterisk start up script exhibit the same behaviour. i.e.: Both work when SELinux is disabled, or don’t work when it’s enabled. Thus, this isn’t an Asterisk problem but rather an SELinux configuration problem.
Either do as david551 suggests in other " [Errors dumping in /var/log/messages]" (Errors dumping in /var/log/messages) thread and disable SELinux, or figure out how to configure SELinux on your server.