Limiting resources in cron jobs

Kirk Strauser kirk at strauser.com
Sat May 16 17:27:27 UTC 2009


I have a jail where the www user runs hourly cron jobs.  On rare  
occasion, these jobs get stuck in a seemingly infinite CPU loop - a  
Python script calls Ghostscript and that child process never returns -  
and I have to manually kill them.  I'd like to use login.conf to set  
resource limits so that I don't have to do this myself, but they don't  
seem to be applied.  Here's a snippet of my login.conf:

www:\
         :cputime=300:\
         :tc=default:

I've run "cap_mkdb /etc/login.conf" to make that live.  Then, I used  
vipw to change www's class:

www:*:80:80:www:0:0:World Wide Web Owner:/nonexistent:/usr/sbin/nologin

However, I can trigger the error condition and watch the child  
Ghostscript process run for 6-7 minutes before I kill it.

It's my understand that cron uses the limits from login.conf.  Any  
idea what I might be doing wrong and causing it not to do so?
-- 
Kirk Strauser






More information about the freebsd-questions mailing list