[systemd-devel] I want to use an environmental variable for LimitNOFILE= in a service unit. Is it possible?
Reindl Harald
h.reindl at thelounge.net
Thu Sep 3 08:07:14 PDT 2015
Am 03.09.2015 um 16:45 schrieb Eliezer Croitoru:
> 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:
i guess it works the same way as for ExecStart params
EnvironmentFile=-/etc/sysconfig/httpd
Environment="PATH=/usr/bin:/usr/sbin"
ExecStart=/usr/sbin/httpd $OPTIONS -D FOREGROUND
[root at rh:~]$ cat /etc/sysconfig/httpd
# Configuration file for the httpd service.
OPTIONS="-D workstation"
STOP_TIMEOUT=5
OPENSSL_NO_DEFAULT_ZLIB=1
LANG=C
[root at rh:~]$ ps aux | grep httpd
root 5079 0.0 0.3 409796 52552 ? Ss 09:48 0:01
/usr/sbin/httpd -D workstation -D FOREGROUND
> [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?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20150903/1825c1cf/attachment.sig>
More information about the systemd-devel
mailing list