[systemd-devel] Getting unit configuration from /etc file

Filipe Brandenburger filbranden at google.com
Thu Aug 16 23:30:36 UTC 2018


On Thu, Aug 16, 2018 at 3:26 PM Kenneth Porter <shiva at sewingwitch.com> wrote:
> Is there some way to fetch a unit variable's value from another file in
> /etc, instead of having it hard-coded in the unit file?
>
> I'd like to use IOSchedulingClass in a unit file, but I'd like to fetch the
> value (idle or none) from a file in the service's /etc directory, so the
> admin doesn't have to copy and edit the unit file from /usr/lib to /etc.
> That way upstream updates to the unit file won't have to be checked for and
> migrated into a custom unit file in /etc. The local setting will
> automatically be applied to any updated unit file.

Yes, that's what a drop-in unit does in systemd.

See here for more details:
https://www.freedesktop.org/software/systemd/man/systemd.unit.html#Description

In short, you can use the command `systemctl edit myunit.service`
which will create an empty drop-in called override.conf and all you
need is to add the settings you want there, for example:

[Service]
IOSchedulingClass=idle

Hopefully this is what you were looking for.

Cheers,
Filipe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4851 bytes
Desc: S/MIME Cryptographic Signature
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20180816/c59599cb/attachment.bin>


More information about the systemd-devel mailing list