<div dir="ltr">Not sure of the best way to do proposed updates here. I have a couple different things that I might suggest here. I’ve found that the AssertDirectory and AssertFile directives are nice so should these directories be empty or file(s) not exist etc you get a big fat failure from systemd on startup. This is handy for production systems. <div><br></div><div>I’ve also found that setting the user and group using systemd behaves more consistently from the systemd unit file then the from the command args or config file, although I generally also set the asterisk user and group in asterisk.conf as well. <br><div><div><br></div><div>This is actually the unit file that I am using in production now:</div><div><div>[Unit]</div><div>Description="Asterisk PBX And Telephony Server"</div><div>Documentation="<a href="http://wiki.asterisk.org">http://wiki.asterisk.org</a>"</div><div>After=network.target </div><div>AssertDirectoryNotEmpty=/etc/asterisk</div><div>AssertDirectoryNotEmpty=/usr/lib/asterisk</div><div>AssertDirectoryNotEmpty=/usr/lib/asterisk/modules</div><div>AssertFileNotEmpty=/etc/asterisk/asterisk.conf </div><div>AssertFileIsExecutable=/usr/sbin/asterisk</div><div><br></div><div>[Service]</div><div>User=asterisk</div><div>Group=asterisk</div><div>Environment=HOME=/var/lib/asterisk</div><div>WorkingDirectory=/var/lib/asterisk</div><div>RuntimeDirectory=/var/run/asterisk</div><div>RuntimeDirectoryMode=0750</div><div>PermissionsStartOnly=true</div><div>ExecStartPre=/bin/rm -rf /var/run/asterisk</div><div>ExecStartPre=/bin/mkdir /var/run/asterisk</div><div>ExecStartPre=/bin/chown -R asterisk:asterisk /var/run/asterisk</div><div>ExecStart=/usr/sbin/asterisk -f -C /etc/asterisk/asterisk.conf</div><div>ExecStop=/usr/sbin/asterisk -rx 'core stop now'</div><div>ExecReload=/usr/sbin/asterisk -rx 'core reload'</div><div>Restart=always</div><div><br></div><div>[Install]</div><div>WantedBy=multi-user.target</div></div><br><div class="gmail_quote"><div dir="ltr">On Mon, May 16, 2016 at 8:56 AM Tzafrir Cohen <<a href="mailto:tzafrir.cohen@xorcom.com">tzafrir.cohen@xorcom.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Wed, May 11, 2016 at 12:51:45PM +0000, Sean Brady wrote:<br>
> Hello all, first time committer here. I have a systemd unit file that I’d<br>
> like to pitch in and could use some advice. Where in the project should<br>
> this file to be placed for make install to do it’s magic? What needs to<br>
> happen to the make install script for this file to be included in the make<br>
> install process? From a community point of view, what are the next steps?<br>
<br>
Thanks for your bug report. It had reminded me that I had a long pending<br>
patch (originally in the ReviewBoard) for just that. I updated it a bit<br>
and it is now on Gerrit:<br>
<br>
<a href="https://gerrit.asterisk.org/2844" rel="noreferrer" target="_blank">https://gerrit.asterisk.org/2844</a><br>
<br>
><br>
> IMHO I don’t think that anything needs to be deprecated in the current make<br>
> install script immediately, as it works as is on Debian Jessie 8 and Centos<br>
> 7 without issue (more testing sorely needed). Eventually I think that we’ll<br>
> need to deprecate all the init.d scripts for distros that are using<br>
> systemd, however until distros start phasing out the init.d process it’s<br>
> probably unnecessary.<br>
<br>
contrib/init.d/rc.mandriva.zaptel should already be removed. I didn't<br>
look at the rest of them.<br>
<br>
><br>
> I’d also like input on exactly how you’d like the systemctl commands to<br>
> function in relation to Asterisk. At the moment, “asterisk -rx ‘core<br>
> reload’” is the action for “systemctl reload asterisk.service” and<br>
> “asterisk -rx ‘core stop now’” for “systemctl stop asterisk.service”. My<br>
> only thoughts/caveats on that is that it may be better to stop convenient<br>
> for the community release. Thoughts?<br>
<br>
When I want to reboot the system, it should happen now. I can't wait for<br>
a call to end (which may be stalled for whatever reason).<br>
<br>
Also note from systemd.service(5): Systemd will run the ExecStop command<br>
and after it returns will kill all the processes remaining in the<br>
control group. Hence merely running 'core stop <later>' is useless, as<br>
systemd will kill it now. In fact, without a wrapper, such an ExecStop<br>
command is probably useless with asterisk.<br>
<br>
--<br>
Tzafrir Cohen<br>
icq#16849755 <a href="mailto:jabber%3Atzafrir.cohen@xorcom.com" target="_blank">jabber:tzafrir.cohen@xorcom.com</a><br>
+972-50-7952406 mailto:<a href="mailto:tzafrir.cohen@xorcom.com" target="_blank">tzafrir.cohen@xorcom.com</a><br>
<a href="http://www.xorcom.com" rel="noreferrer" target="_blank">http://www.xorcom.com</a><br>
<br>
--<br>
_____________________________________________________________________<br>
-- Bandwidth and Colocation Provided by <a href="http://www.api-digital.com" rel="noreferrer" target="_blank">http://www.api-digital.com</a> --<br>
<br>
asterisk-dev mailing list<br>
To UNSUBSCRIBE or update options visit:<br>
<a href="http://lists.digium.com/mailman/listinfo/asterisk-dev" rel="noreferrer" target="_blank">http://lists.digium.com/mailman/listinfo/asterisk-dev</a></blockquote></div></div></div></div>