[systemd-devel] 回复: 回复: 回复: 回复: 回复: 回复: 回复: 回复: [systemd-d e vel] sys t emctl can't executestopactually,whenserviceisstarted by other way

Lennart Poettering lennart at poettering.net
Wed Nov 1 17:52:19 UTC 2017


On Mi, 01.11.17 19:07, 清辰 (624001899 at qq.com) wrote:

> Hi Lennart,
> 
> For example, shell command: ulimit -Sn `ulimit -Hn`
> It will set soft limit to hard limit.
>
> I want to achieve it in systemd.unit.
> 
> Can you get my point?

This is not supported. But do note that the kernel sets RLIMIT_NOFILE
to 1024:4096 by default, and this is what systemd passes on to the
processes it forks off. Also note, that the resource limit code in
systemd will actually bump the limits to the configured value with a
fallback of the highest permitted limit if the requested one is
prohibited for some policy reason.

That means, if you set LimitNOFILE=4096 in your service, you get what
you are asking for.

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list