<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Jun 17, 2016 at 7:04 PM, Brian Kroth <span dir="ltr"><<a href="mailto:bpkroth@gmail.com" target="_blank">bpkroth@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Mantas Mikulėnas <<a href="mailto:grawity@gmail.com" target="_blank">grawity@gmail.com</a>> 2016-06-17 07:47:<div><div class="h5"><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Fri, Jun 17, 2016 at 6:01 AM, Brian Kroth <<a href="mailto:bpkroth@gmail.com" target="_blank">bpkroth@gmail.com</a>> wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi again, related to my inetd conversion example, in my .service unit I<br>
have something like this:<br>
<br>
# nagios-nrpe-server@.service:<br>
[Service]<br>
Environment=NICENESS=0<br>
EnvironmentFile=-/etc/default/nagios-nrpe-server<br>
ExecStart=/usr/sbin/nrpe -i $DAEMON_OPTIONS<br>
Nice=$NICENESS<br>
<br>
# /etc/default/nagios-nrpe-server:<br>
DAEMON_OPTIONS="--no-ssl"<br>
#NICENESS=5<br>
INETD=1<br>
<br>
<br>
With that I get this sort of error message:<br>
[/etc/systemd/system/nagios-nrpe-server@.service] Failed to parse nice<br>
priority, ignoring: $NICENESS<br>
<br>
I added the leading "Environment=NICENESS=0" directive to try and make<br>
sure it wasn't just an empty variable kinda thing, but it didn't seem to<br>
help.<br>
<br>
<br>
It's somewhat unclear from the man pages as to whether or not $VAR<br>
expansion is done outside of the Exec* directives, and I couldn't find a<br>
definitive answer online, but based on the above, I'm guessing it's not,<br>
correct?<br>
<br>
</blockquote>
<br>
No, they're not expanded anywhere else.<br>
<br>
Generally it's best to entirely avoid indirection via /etc/default, and<br>
just configure daemons directly via their .service units. (Unlike init<br>
scripts, they're freely editable by sysadmins.) In certain cases, a<br>
variable for command-line arguments might make sense, but $NICENESS? Why?<br>
</blockquote>
<br></div></div>
It was mostly an exercise in understanding as I went through the process of trying to convert a legacy init script over for myself.<br>
<br>
I think I agree with you that it's easy enough to add the /etc/systemd/system/$service.conf.d/override.conf style overrides for individual parameters like that.<br>
<br>
The distaste I guess I'm left with is that, at least as things transition, we end up having to look in several places to figure out where all the configuration sources are coming from (eg: /etc/default, /{etc,run,lib}/systemd, etc.). It's not always clear on first glance which parts are respected by other parts.</blockquote><div><br></div><div>Use `systemctl cat <service>` (when a more recent systemd reaches your distro), and `systemd-delta`.</div></div><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Mantas Mikulėnas <<a href="mailto:grawity@gmail.com" target="_blank">grawity@gmail.com</a>></div></div>
</div></div>