Sig-I/O (Posts about limit)https://sig-io.nl/categories/limit.atom2023-05-25T20:58:04ZMark JanssenNikolaRun-time editing of limits in Linuxhttps://sig-io.nl/posts/run-time-editing-of-limits-in-linux/2012-02-14T23:24:21+02:002012-02-14T23:24:21+02:00Mark Janssen<p>On CentOS and RHEL Linux (with kernels >= 2.6.32) you can modify resource-limits (ulimit) run-time. This can be done using the /proc/<pid>/limits functionality. On older kernels this file is read-only and can be used to inspect the limits that are in effect on the process. On newer systems you can modify the limits with echo:</p>
<blockquote>
<p>cat /proc/pid/limits
echo -n "Max open files=soft:hard" > /proc/pid/limits
cat /proc/pid/limits</p>
</blockquote>
<p>On older systems you will have to modify limits before starting a process.</p>
<p>(See also the post on <a class="reference external" href="http://serverfault.com/questions/201207/set-max-file-limit-on-a-running-process">serverfault</a>)</p>
<p>If you are not running CentOS/RHEL, you can use the ‘prlimit’ command, which does the same thing, but doesn’t rely on a patch that’s no longer present in current kernels.</p>