[systemd-devel] I want to use an environmental variable for LimitNOFILE= in a service unit. Is it possible?

Eliezer Croitoru eliezer at ngtech.co.il
Thu Sep 3 07:45:15 PDT 2015


Hey,

I am working on a service for squid caching service.
I have a need to define LimitNOFILE from an environmental variable 
instead of only the service file.
The service unit I am using is:
##START
[Unit]
Description=Squid Web Proxy Server
Documentation=man:squid(8)
After=network.target

[Service]
EnvironmentFile=-/etc/sysconfig/squid
Type=forking
LimitNOFILE=16384
PIDFile=/var/run/squid.pid
ExecStartPre=/usr/bin/mkdir -p /var/run/squid
ExecStartPre=/usr/bin/chown squid.squid /var/run/squid
ExecStart=/usr/sbin/squid -sYC
ExecReload=/usr/sbin/squid -kreconf
ExecStop=/usr/sbin/squidshut.sh
TimeoutStopSec=36
KillMode=none

[Install]
WantedBy=multi-user.target
##END

I have tried couple things and I think I am in the wrong way.
Maybe there is some include file I can use as configurable else then 
EnvironmentFile to just contain the LimitNOFILE variable?

Thanks,
Eliezer


More information about the systemd-devel mailing list