[asterisk-users] Asterisk installation script on CentOS7 with systemd

Tzafrir Cohen tzafrir.cohen at xorcom.com
Tue Dec 20 05:37:59 CST 2016

On Mon, Dec 19, 2016 at 03:54:47PM +0100, Olivier wrote:
> Hello,
> For a new project, I'm adapting existing installation script to CentOS 7.
> I must admit I don't understand how to adapt things to systemd.
> Here are my questions:
> 1. I don't see any systemd sub-directory in asterisk-13.13.1/contrib.
> Do you think such directory and matching Makefile target could be useful ?
> 2. Should /run/asterisk directory creation be left to systemd or done by
> installation script before running "systemctl start asterisk"  ?
> 3. I edited the following /etc/systemd/system:asterisk.service file:
> [Unit]
> Description=Asterisk PBX and telephony daemon.
> After=network.target
> [Service]
> Type=forking
> PIDFile=/var/run/asterisk/asterisk.pid

Remove those two (or get latest version with sd_notify support, make
sure it works, and use 'Type=notify')

> Environment=HOME=/var/lib/asterisk
> WorkingDirectory=/var/lib/asterisk
> ExecStart=/usr/sbin/asterisk -vvvgF -U asterisk -G asterisk -C

Drop -F as well

> /etc/asterisk/asterisk.conf
> #ExecStart=/usr/sbin/asterisk -vvvgF -C /etc/asterisk/asterisk.conf
> ExecStop=/usr/sbin/asterisk -rx 'core stop now'

I'm trying to think if this is needed. Anything wrong with just letting
systemd kill asterisk and all of its child precesses?

> ExecReload=/usr/sbin/asterisk -rx 'core reload'

Also, IIRC:


               Tzafrir Cohen
icq#16849755              jabber:tzafrir.cohen at xorcom.com
+972-50-7952406           mailto:tzafrir.cohen at xorcom.com

More information about the asterisk-users mailing list