Cron fix for ulimit: max user processes: cannot modify limit:operation not permitted

Werner Puschitz has details of how to use ulimit and limits.conf to change maximum processes and open file descriptors.

But for processes running from cron, I found I had to additionally make the below changes (this is on old version: 32 bit Linux 2.4.21-27.ELsmp Red Hat Enterprise Linux AS release 3 (Taroon Update 4) – maybe not needed for newer versions).

vi /etc/init.d/crond

Add lines like:

ulimit -Hu 131072  # new line Jul 2011
ulimit -Su 131072  # new line Jul 2011
ulimit -Hn 262144  # new line Jul 2011
ulimit -Sn 262144  # new line Jul 2011

These should be the first commands in that file.

Restart cron with:

/etc/init.d/crond restart

Not relevant for cron, but file /etc/profile is loaded at login and may have been edited to contain ulimit settings – if so those lines would need changed or removed for normal (non cron) logins.

Thanks to Michael Heiming for this.

July 14, 2011

  • -bash: ulimit: open files: cannot modify limit: Operation not permitted

    this problem doed not resolve

  • Leave a Reply

    Your email address will not be published. Required fields are marked *