SLUG Mailing List Archives
Re: [chat] Killing run away scripts
- To: chat slug <slug-chat@xxxxxxxxxxx>
- Subject: Re: [chat] Killing run away scripts
- From: chesty@xxxxxxxxxxxx
- Date: Sun Oct 28 20:39:01 2001
- User-agent: Mutt/1.3.22i
On Sun, Oct 28, 2001 at 04:28:56PM +1100, Ken Foskey wrote:
> What I was thinking is how I can register a kill command after a couple
> of hours. This whole process takes minutes and if it is hours then it
> has screwed up. Is there anyway of doing this portably between unices.
You could stick this in your shell scripts.
ulimit -t 3600
Don't know if its portable, or even if its a good idea, but the script and
any processes it spawns should die after they've used 3600 seconds of cpu time.
Depending on how hard the process is hitting the cpu, it could take years to
hit 3600 seconds of cpu time, or if its in a tight loop it could take a little
over an hour.
$ ulimit -t 60
$ time echo "while : ; do : ; done" | sh -s