Summary:ASTERISK-21991: [patch] - install a systemd service unit
Reporter:Tzafrir Cohen (tzafrir)Labels:patch
Date Opened:2013-07-01 15:18:16Date Closed:
Versions:SVN 13.18.4 Frequency of
is duplicated byASTERISK-25988 Asterisk is lacking a systemd unit file
Environment:Attachments:( 0) 0001-install-a-systemd-service.patch
Description:systemd is a new init system used by various Linux distributions. It aims at providing an environment that is compatible among different distributions, and hence its service configuration files ("units") are eto be provided from Upstream.

The attached patch includes a simple version of a systemd unit for Asterisk, as well as installing it. It is not enabled, though.
Comments:By: Matt Jordan (mjordan) 2013-07-31 20:22:01.503-0500

I don't have any reservations about having this go in, but posting it to review board still feels appropriate. I'll go ahead and throw it up there since tonight is feature freeze for 12.

By: Max (god) 2015-11-11 05:27:26.880-0600

Here is another example of asterisk.service file which seems to be more aligned with the distributions package it (use of separate user/group, autorestart etc):

Description=Asterisk PBX and telephony daemon

ExecStart=/usr/bin/asterisk -f -C /etc/asterisk/asterisk.conf
ExecStop=/usr/bin/asterisk -rx 'core stop now'
ExecReload=/usr/bin/asterisk -rx 'core reload'



By: Tzafrir Cohen (tzafrir) 2015-11-11 05:43:05.712-0600

Just one comment:


is probably not what you would expect. it means that after: rasterisk -x 'core stop now' # the asterisk service will restart. It would probably be better to have:


Also: why did you change it to RestartSec=10 #?

By: Max (god) 2015-11-11 05:47:29.412-0600

You're right, on-failure is the right one. As for 10 sec. - just an arbitrary value, not sure if bigger/smaller value would be better.

It would be much easier if ASTERISK-25541 gets implemented.

By: Tzafrir Cohen (tzafrir) 2015-11-11 06:05:41.833-0600

Some features (such as -p) require asterisk to be run as root. If you use those, you should not use User=asterisk.

I should also point out to https://reviewboard.asterisk.org/r/3062/