<div dir="ltr"><div><div>Hello,<br><br></div>For a new project, I'm adapting existing installation script to CentOS 7.<br>I must admit I don't understand how to adapt things to systemd.<br><br></div><div>Here are my questions:<br></div><div><br>1. I don't see any systemd sub-directory in asterisk-13.13.1/contrib.<br></div><div>Do you think such directory and matching Makefile target could be useful ?<br><br></div><div>2. Should /run/asterisk directory creation be left to systemd or done by installation script before running "systemctl start asterisk"  ?<br></div><div><br></div><div>3. I edited the following /etc/systemd/system:asterisk.service file:<br>[Unit]<br>Description=Asterisk PBX and telephony daemon.<br>After=network.target<br><br>[Service]<br>Type=forking<br>PIDFile=/var/run/asterisk/asterisk.pid<br>Environment=HOME=/var/lib/asterisk<br>WorkingDirectory=/var/lib/asterisk<br>ExecStart=/usr/sbin/asterisk -vvvgF -U asterisk -G asterisk -C /etc/asterisk/asterisk.conf<br>#ExecStart=/usr/sbin/asterisk -vvvgF -C /etc/asterisk/asterisk.conf<br>ExecStop=/usr/sbin/asterisk -rx 'core stop now'<br>ExecReload=/usr/sbin/asterisk -rx 'core reload'<br><br><br>[Install]<br>WantedBy=multi-user.target<br><br></div><div>Running systemctl start asterisk fails with :<br>Dec 19 15:43:08 foobar systemd: PID file /var/run/asterisk/asterisk.pid not readable (yet?) after start.<br>Dec 19 15:43:09 foobar systemd: asterisk.service: main process exited, code=exited, status=1/FAILURE<br>Dec 19 15:43:09 foobar asterisk: Unable to connect to remote asterisk (does /var/run/asterisk/asterisk.ctl exist?)<br>Dec 19 15:43:09 foobar systemd: asterisk.service: control process exited, code=exited status=1<br>Dec 19 15:43:09 foobar systemd: Unit asterisk.service entered failed state.<br>Dec 19 15:43:09 foobar systemd: asterisk.service failed.<br><br><br></div><div>But /usr/sbin/asterisk -vvvgF -U asterisk -G asterisk -C /etc/asterisk/asterisk.conf succeeds:<br># rasterisk <br>Asterisk 13.13.1, Copyright (C) 1999 - 2014, Digium, Inc. and others.<br>...<br>=========================================================================<br>Running as user 'asterisk'<br>Running under group 'asterisk'<br>Connected to Asterisk 13.13.1 currently running on ...<br></div><div><br></div><div>Any hint or help on how to debug this ?<br></div><div>(I tried with and without any /run/asterisk directory owned by asterisk.asterisk)<br><br><br></div><div>Best regards<br></div></div>