<div dir="ltr"><div><div><div><div><div><div><div><div><div><div>Hello,<br><br></div>I've been tasked to enable automatic Asterisk restart on failure on a Jessie platform (running latest Asterisk 13.15.0).<br><br></div>I build a dedicated Jessie VM on which I installed Asterisk from source.<br></div>I configured a couple of files in /etc/asterisk directory.<br></div>I positively checedk that with simple config, Asterisk could sucessively start using an /etc/init.d/asterisk file and sysv-systemd compatibility tools.<br><br></div>Then I copied a /etc/systemd/system/asterisk.service file with the following content:<br><br>[Unit]<br>Description=Asterisk PBX<br>Documentation=man:asterisk(8)<br>Wants=network-online.target<br>After=network-online.target<br><br>[Service]<br>Type=notify<br>ExecStart=/usr/sbin/asterisk -g -f -U asterisk<br>ExecReload=/usr/sbin/asterisk -rx 'core reload'<br>Restart=no<br>RestartSec=1<br>WorkingDirectory=/var/lib/asterisk<br><br>[Install]<br>WantedBy=multi-user.target<br><br></div>Please, note that this file has the same content as file /lib/systemd/system/asterisk.service in Debian Stretch expect for line Restart=on-failure I changed to Restart=no, for the moment.<br><br><br></div>After creating above asterisk.service file, running "systemctl daemon-reload" and "systemctl start asterisk", I could observe:<br></div>- asterisk is starting OK,<br></div>- asterisk prints to its log file a line such as:<br>[Apr 20 11:23:22] VERBOSE[770] asterisk.c: Asterisk Ready.<br><br></div>but, at the same time, I got:<br>april 20 11:23:22 jessievm asterisk[770]: [Apr 20 11:23:22] NOTICE[770]: app_queue.c:9095 reload_queues: No call queueing config fil<br>april 20 11:24:48 jessievm systemd[1]: asterisk.service start operation timed out. Terminating.<br>april 20 11:24:48 jessievm asterisk[770]: <br>april 20 11:24:48 jessievm systemd[1]: Failed to start Asterisk PBX.<br><div><div><div><div><div><div><br><br></div><div>If I'm not mistaken:<br></div><div>- lastest "Asterisk Ready" line is visible in /var/log/asterisk/full but invisible in Systemd journal,<br></div><div>- things work as if Systemd was not notified of Asterisk successful start and than decided to stop Asterisk,<br></div><div>- man page [1] mentions support of type=notify in Debian Jessie<br></div><div>- on Stretch, I used asterisk 13.14.0 while I used asterisk 13.15.0, so I supposed this issue doesn't come from Asterisk itself but the way I configured my system.<br></div><div><br><br></div><div>Systemd versions are:<br></div><div>Jessie:<br>systemd 215<br>+PAM +AUDIT +SELINUX +IMA +SYSVINIT +LIBCRYPTSETUP +GCRYPT +ACL +XZ -SECCOMP -APPARMOR<br><br></div><div>Stretch:<br>systemd 232<br>+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD +IDN<br></div><div><br><br></div><div>My questions are:<br></div><div>1. Is it possible to use systemd's Restart=on-failure option to automaticaly restart Asterisk, given Jessie systemd version ?<br></div><div>2. If positive, how ?<br></div><div>3. If negative, which option would you recommend (Monit ? ) ?<br><br></div><div>Best regards<br></div><div><br><br>[1] <a href="https://manpages.debian.org/jessie/systemd/systemd.service.5.en.html">https://manpages.debian.org/jessie/systemd/systemd.service.5.en.html</a><br></div></div></div></div></div></div></div>