You are not logged in.
What is the preferred way to modify the limits on a service that runs under systemd?
In my case, I'm running btsync@username as a service, wherein the service will run as the user account, and I'm reaching the open file limit on multiple bittorrent shares when they attempt to sync.
I have tried temporarily changing the limits of the running process:
sudo sh -c "echo -n 'Max open files=8192:16384' > /proc/${pid_of_btsync}/limits"
This results in
sh: line 0: echo: write error: Invalid argument
I have tried adding this to /etc/sysctl.d/99-max-files.conf
fs.file-max = 100000
I have tried adding the following two lines to /etc/security/limits.conf:
* soft nofile 8192
* hard nofile 16384
Regardless of what I do, the proc limits file reflects the following:
Max open files 1024 4096 files
I'm going to guess that this is getting inherited from systemd since it's launching the service.
I don't need a permanent solution, as I only need enough file descriptors to get the initial sync across. Even then, I seem to be having problems implementing ANY solution, and if I ever were to launch a process that used a lot of descriptors, it would be good to know what the best way to go about this is.
Offline
Look at systemd.exec(5) LimitNOFILE=
Offline