[asterisk-users] Backport of Stretch's asterisk.service file into Jessie: successful start not detected by systemd

Olivier oza.4h07 at gmail.com
Thu Apr 20 05:02:36 CDT 2017


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

Then I copied a /etc/systemd/system/asterisk.service file with the
following content:

Description=Asterisk PBX

ExecStart=/usr/sbin/asterisk -g -f -U asterisk
ExecReload=/usr/sbin/asterisk -rx 'core reload'


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:
systemd 215

systemd 232

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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20170420/d41e6bc6/attachment.html>

More information about the asterisk-users mailing list