[systemd-devel] I want to use an environmental variable for LimitNOFILE= in a service unit. Is it possible?
Tomasz Torcz
tomek at pipebreaker.pl
Thu Sep 3 10:25:20 PDT 2015
On Thu, Sep 03, 2015 at 08:08:13PM +0300, Eliezer Croitoru wrote:
> I noticed it doesn't work.
> And well since I am building an RPM the only option I can think of is either
> use a custom startup script which will set the limits manually or define the
> service as a config file in the RPM.
>
> Maybe you have some experience with overwriting the service files with RPMS,
> maybe there is some kind of practice use for this?
>
> The main issue is that if I hardcode it in the service file the RPM will
> replace it each and every time.
> If I will use it as a config file it will stay the same and it might be the
> better solution.
> Seeking after thought and ideas on the best way to implement it.
systemd come with quite cool system of unit precedence and is very
customisation-friendly for admin. Just ship your unit in /usr/lib/systemd/system/
directory with default value of LimitNOFILE=. If administrators want to
override, he will create dropin /etc/systemd/system/squid.service.d/10-limits.conf
with
–––
[Service]
LimitNOFILE=newvalue
–––
and it will work fine during the upgrades.
--
Tomasz Torcz ,,If you try to upissue this patchset I shall be seeking
xmpp: zdzichubg at chrome.pl an IP-routable hand grenade.'' -- Andrew Morton (LKML)
More information about the systemd-devel
mailing list