[kwlug-disc] Clock-time limits

Chris Irwin chris at chrisirwin.ca
Mon Jun 15 08:45:50 EDT 2009


On Sun, Jun 14, 2009 at 22:19, Andrew Kohlsmith (Mailing List
Account)<aklists at mixdown.ca> wrote:
> On May 6, 2009 07:31:15 pm Chris Irwin wrote:
>> List, is there a way to limit the amount of clock-time a program is
>> allowed to run?
>>
>> I currently use offlineimap via cron to cache my mail locally. It
>> unfortunately seems to have a habit of becoming unresponsive if it
>> happens to be active when I suspend/resume my laptop (probably the
>> network disappearing). This then causes me to not (locally) receive any
>> mail as when spawned by cron again it bails out due to the existing
>> process.
>>
>> I could add 'pkill offlineimap' to the start of my wrapper script, but
>> was hoping for something more elegant.
>
> ulimit -t sounds like what you're looking for.
>
> man bash, search for ulimit.  I use this to test fork bombs.  :-)

ulimit only limits CPU time, I'm more interested in wall time. It can
take a long time for a non-responsive but non-CPU-intensive
application to hit 5 minutes of CPU time.

Khalid's posted solution with `at` was the best for my purposes, and I
am currently using it.

-- 
Chris Irwin
<chris at chrisirwin.ca>




More information about the kwlug-disc mailing list