Hello, I've been tasked to enable automatic Asterisk restart on failure on a Jessie platform (running latest Asterisk 13.15.0).
I build a dedicated Jessie VM on which I installed Asterisk from source. I configured a couple of files in /etc/asterisk directory. I positively checedk that with simple config, Asterisk could sucessively start using an /etc/init.d/asterisk file and sysv-systemd compatibility tools. Then I copied a /etc/systemd/system/asterisk.service file with the following content: [Unit] Description=Asterisk PBX Documentation=man:asterisk(8) Wants=network-online.target After=network-online.target [Service] Type=notify ExecStart=/usr/sbin/asterisk -g -f -U asterisk ExecReload=/usr/sbin/asterisk -rx 'core reload' Restart=no RestartSec=1 WorkingDirectory=/var/lib/asterisk [Install] WantedBy=multi-user.target 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. After creating above asterisk.service file, running "systemctl daemon-reload" and "systemctl start asterisk", I could observe: - asterisk is starting OK, - asterisk prints to its log file a line such as: [Apr 20 11:23:22] VERBOSE[770] asterisk.c: Asterisk Ready. but, at the same time, I got: 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 april 20 11:24:48 jessievm systemd[1]: asterisk.service start operation timed out. Terminating. april 20 11:24:48 jessievm asterisk[770]: april 20 11:24:48 jessievm systemd[1]: Failed to start Asterisk PBX. If I'm not mistaken: - lastest "Asterisk Ready" line is visible in /var/log/asterisk/full but invisible in Systemd journal, - things work as if Systemd was not notified of Asterisk successful start and than decided to stop Asterisk, - man page [1] mentions support of type=notify in Debian Jessie - 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. Systemd versions are: Jessie: systemd 215 +PAM +AUDIT +SELINUX +IMA +SYSVINIT +LIBCRYPTSETUP +GCRYPT +ACL +XZ -SECCOMP -APPARMOR Stretch: systemd 232 +PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD +IDN My questions are: 1. Is it possible to use systemd's Restart=on-failure option to automaticaly restart Asterisk, given Jessie systemd version ? 2. If positive, how ? 3. If negative, which option would you recommend (Monit ? ) ? Best regards [1] https://manpages.debian.org/jessie/systemd/systemd.service.5.en.html
-- _____________________________________________________________________ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- Check out the new Asterisk community forum at: https://community.asterisk.org/ New to Asterisk? Start here: https://wiki.asterisk.org/wiki/display/AST/Getting+Started asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users