VoIP Mailing List Archives
Mailing list archives for the VoIP community |
|
View previous topic :: View next topic |
Author |
Message |
viljoens at verishare.... Guest
|
Posted: Mon May 09, 2016 1:47 am Post subject: [asterisk-users] Proper way to start Asterisk on CentOS 7? ( |
|
|
Hi Carlos
I have experienced something similar starting Asterisk 1.8.32.3 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
ready.
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:
--
[Unit]
Description=Asterisk
After=network.target
After=network-online.target
After=startup.service
After=mysql.service
Wants=mysql.service
[Service]
Type=idle
User=root
Group=root
ExecStart=/usr/sbin/asterisk -f
ExecStop=/usr/sbin/asterisk -rx 'core stop now'
ExecReload=/usr/sbin/asterisk -rx 'core reload'
TimeoutSec=300
LimitCORE=infinity
LimitNOFILE=8096
Restart=always
RestartSec=4
[Install]
WantedBy=multi-user.target
--
I place this in /etc/systemd/system as "asterisk.service" and then install
it via
systemctl enable asterisk.service
Hope this helps.
Stefan
-----------------
Message: 1
Date: Thu, 5 May 2016 12:07:37 -0500
From: Carlos Chavez <cursor@telecomabmex.com>
To: "asterisk-users@lists.digium.com"
<asterisk-users@lists.digium.com>
Subject: [asterisk-users] Proper way to start Asterisk on CentOS 7?
Message-ID: <572B7DD9.4090503@telecomabmex.com>
Content-Type: text/plain; charset=utf-8; format=flowed
I am having a strange problem with Asterisk 13 on a CentOS 7 plataform.
I have several servers running on this configuration but a particular
installation on a Dell PowerEdge 220 server is the one giving me the most
problems. All installations are automated via a script so there is no
difference but the hardware. All dependencies are installed and there are
no errors during installation. We use realtime mysql for our
configurations.
The problem comes when Asterisk is started from init.d/asterisk.
Asterisk loads but phones will not register and the Asterisk CLI will not
respond to commands. Something like "pjsip show endpoints" shows nothing
and sometimes the CLI hangs. Asterisk itself is not crashing and if I open
another terminal I can get into the CLI even though the other terminal is
not responding. If I start Asterisk manually from the command line
everything works as expected, phones register and calls flow.
I tried a systemd startup script someone published but I get the same
result as the initd script. I wonder why I am only getting this problem on
the Dell 220 server but not on other servers (even a Dell T20 server does
not have the same problem). My office server is an HP ML110 and has been
working with Asterisk 13 and CentOS 7 for over 6 months now with no issues.
It uses the init.d script that comes with Asterisk and it has never hanged.
Anyone know if the PowerEdge 220 server has special issues with Linux
or Asterisk in particular? How do you recommend starting Asterisk?
--
Telecomunicaciones Abiertas de M?xico S.A. de C.V.
Carlos Ch?vez
+52 (55)9116-91161
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users |
|
Back to top |
|
|
tzafrir.cohen at xorco... Guest
|
Posted: Mon May 09, 2016 3:42 am Post subject: [asterisk-users] Proper way to start Asterisk on CentOS 7? ( |
|
|
On Mon, May 09, 2016 at 08:46:36AM +0200, Stefan Viljoen wrote:
Quote: | Hi Carlos
I have experienced something similar starting Asterisk 1.8.32.3 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
ready.
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:
--
[Unit]
Description=Asterisk
After=network.target
After=network-online.target
After=startup.service
|
Quote: | After=mysql.service
Wants=mysql.service
|
IIRC, mysql is socket activated, and hence services don't need to have
any explicit dependency on it Remove those two.
Quote: |
[Service]
Type=idle
|
Huh? Stick the the default: Type=basic. No need to mention this one.
Quote: | User=root
Group=root
|
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)
User=asterisk
Quote: | 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.
Quote: |
LimitCORE=infinity
LimitNOFILE=8096
Restart=always
|
Restart=on-failure
With your current configuration:
asterisk -rx 'core stop now'
becomes a restart.
I used a bit less.
Quote: |
[Install]
WantedBy=multi-user.target
--
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
/usr/lib/systemd/system/asterisk.service
Here it is:
[Unit]
Description=Asterisk PBX
Documentation=man:asterisk(
Wants=network-online.target
After=network-online.target
[Service]
ExecStart=/usr/sbin/asterisk -g -f -U asterisk
ExecReload=/usr/sbin/asterisk -rx 'core reload'
Restart=on-failure
RestartSec=1
WorkingDirectory=/var/lib/asterisk
# 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)
#include /lib/systemd/system/asterisk.service
#[Service]
#
# 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.
#ExecStopPost=/path/to/script
#Nice=0
#UMask=0002
#LimitCORE=infinity
#LimitNOFILE=
# 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:
#TTYPath=/dev/tty9
#StandardInput=tty
#StandardOutput=tty
#StandardError=tty
# For more information on what these parameters mean see:
#
# http://0pointer.de/public/systemd-man/systemd.service.html
# http://0pointer.de/public/systemd-man/systemd.exec.html
[Install]
WantedBy=multi-user.target
--
Tzafrir Cohen
icq#16849755 jabber:tzafrir.cohen@xorcom.com
+972-50-7952406 mailto:tzafrir.cohen@xorcom.com
http://www.xorcom.com
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users |
|
Back to top |
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|