This is a discussion on Change process limits ("ulimit") for cron jobs ? within the Linux Operating System forums, part of the Unix Operating Systems category; --> Hi, I've a relatively fresh out-of-the-box Suse 9.0 box. I want to set up a job via cron that ...
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hi, I've a relatively fresh out-of-the-box Suse 9.0 box. I want to set up a job via cron that starts an application with up to 1800 java threads; java threads are mapped as processes so the application needs to be allowed to run 1800 processes. I changed /etc/security.limits.conf * hard nofile 8192 * hard nproc 8192 THIS should really be enough ,-) And I added the following line to /etc/pam.d/login as well as /etc/pam.d/sshd (the later one for testing, see below) session required pam_limits.so debug My problem is now that a simple cronjob, where I can test this, does not work as supposed: ( ulimit -a ; echo ; ulimit -n 4096 ; echo ; ulimit -a ) 2>&1 | mail foobar results in an error message "/bin/sh: line 1: ulimit: open files: cannot modify limit: Operation not permitted". Funny enough: If I login via ssh it's not a problem, works like a charm. Also while using sshd I can see from the log file, that the limits module really is pulling the settings out of the limits.conf file so I suppose the mechanism itself work. Naive like I am I tried to add the above line to a newly create file /etc/pam.d/cron (and "crond" as well) but this did not helped anything. So...what the bl**dy hell am I doing wrong? Thanks a lot, Soeren Gerlach |
| ||||
| -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 NotDashEscaped: You need GnuPG to verify this message In comp.os.linux.setup Soeren Gerlach <soeren@all-about-shift.com> suggested: > Hi, > I've a relatively fresh out-of-the-box Suse 9.0 box. I want to set up > a job via cron that starts an application with up to 1800 java > threads; java threads are mapped as processes so the application needs > to be allowed to run 1800 processes. > I changed /etc/security.limits.conf > * hard nofile 8192 > * hard nproc 8192 [..] > My problem is now that a simple cronjob, where I can test this, does > not work as supposed: > ( ulimit -a ; echo ; ulimit -n 4096 ; echo ; ulimit -a ) 2>&1 | mail > foobar > results in an error message "/bin/sh: line 1: ulimit: open files: > cannot modify limit: Operation not permitted". Yup, some versions of cron do not seem to honor limits.conf, you could put in your /etc/init.d/crond, before cron starts: ulimit -Hn 8192 ulimit -Sn 8192 ulimit -Hu 8192 ulimit -Su 8192 Restart crond and see if this works better, not a very nice approach. -- Michael Heiming (GPG-Key ID: 0xEDD27B94) mail: echo zvpunry@urvzvat.qr | perl -pe 'y/a-z/n-za-m/' -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) iD8DBQFA/gsMAkPEju3Se5QRAjy+AJ0RGdm0R5Y2aNkGXL2zQ+o7uHNW3gC fc9Ic i4I/Z6vUUQ9dOFiGOjaU5YU= =Wgg2 -----END PGP SIGNATURE----- |