[asterisk-users] Proper way to start Asterisk on CentOS 7? (Carlos Chavez)
tzafrir.cohen at xorcom.com
Mon May 9 03:29:41 CDT 2016
On Mon, May 09, 2016 at 08:46:36AM +0200, Stefan Viljoen wrote:
> Hi Carlos
> I have experienced something similar starting Asterisk 220.127.116.11 on Centos 7
> on commodity / whitebox hardware.
> The problem was that Asterisk was starting "too quickly" in the systemd
> startup sequence, before the required services it needs to run were up and
> I eventually came up with this systemd script to start it, and this now
> starts Asterisk on all our our new Centos 7-using deployments.
> Maybe you can try it out...? This starts our Asterisk 1.8 instances without
> problems on Centos 7 on boot:
IIRC, mysql is socket activated, and hence services don't need to have
any explicit dependency on it Remove those two.
Huh? Stick the the default: Type=basic. No need to mention this one.
Those two are superfluous. And anyway, are wrong. Asterisk is a
network-facing daemon, and as such should run with it
# (Be sure to create that one)
> ExecStart=/usr/sbin/asterisk -f
> ExecStop=/usr/sbin/asterisk -rx 'core stop now'
> ExecReload=/usr/sbin/asterisk -rx 'core reload'
Right. But see my note below about Restart.
Not sure what this is for.
With your current configuration:
asterisk -rx 'core stop now'
becomes a restart.
I used a bit less.
> I place this in /etc/systemd/system as "asterisk.service" and then install
> it via
> systemctl enable asterisk.service
Fine. I placed mine as part of a package, and hence it is
Here it is:
ExecStart=/usr/sbin/asterisk -g -f -U asterisk
ExecReload=/usr/sbin/asterisk -rx 'core reload'
# Extra settings:
# If you want to set them, you can generate the file
# /etc/systemd/system/asterisk.service that has the following lines
# (without the comments)
# and following those two lines add directives or override existing
# directives. Some extra directives that may be useful:
# You can run a script to clean up after asterisk. An example script is
# included in contrib/scripts/asterisk_cleanup.
# safe_asterisk runs Asterisk in a virtual console. This allows easy
# access to the asterisk command-line without logging it. on the other
# hand, it allows anyone with physical access to the console full access
# to Asterisk. To enable this console, unrem the following lines and add
# '-c' to the ExecStart line above:
# For more information on what these parameters mean see:
icq#16849755 jabber:tzafrir.cohen at xorcom.com
+972-50-7952406 mailto:tzafrir.cohen at xorcom.com
More information about the asterisk-users