All of lore.kernel.org
 help / color / mirror / Atom feed
* process time limit?
@ 2002-06-26 23:39 Jim Reimer
  2002-06-27  0:52 ` Jos Lemmerling
  2002-06-27  7:22 ` James Mohr
  0 siblings, 2 replies; 3+ messages in thread
From: Jim Reimer @ 2002-06-26 23:39 UTC (permalink / raw)
  To: linux-newbie

I have a script run by cron once every half hour which
gets a RADAR image, does some manipulation on the file,
and stores it.  It's been running fine for a few weeks
now.

However, when I got home from work today, the computer
was *very* sluggish, and 'ps' showed many many instances
of both the script and 'giftopnm' (one of the programs
used in the script).  I don't know what went wrong, but
giftopnm was hanging and not allowing the script to
complete.

So - is there any way to limit the amount of time a
cronjob (or any other job) can live?

Hints appreciated...

-jdr-
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: process time limit?
  2002-06-26 23:39 process time limit? Jim Reimer
@ 2002-06-27  0:52 ` Jos Lemmerling
  2002-06-27  7:22 ` James Mohr
  1 sibling, 0 replies; 3+ messages in thread
From: Jos Lemmerling @ 2002-06-27  0:52 UTC (permalink / raw)
  To: linux-newbie; +Cc: Jim Reimer

On Wed, 26 Jun 2002, Jim Reimer wrote:

> I have a script run by cron once every half hour which
> gets a RADAR image, does some manipulation on the file,
> and stores it.  It's been running fine for a few weeks
> now.
> 
> However, when I got home from work today, the computer
> was *very* sluggish, and 'ps' showed many many instances
> of both the script and 'giftopnm' (one of the programs
> used in the script).  I don't know what went wrong, but
> giftopnm was hanging and not allowing the script to
> complete.
> 
> So - is there any way to limit the amount of time a
> cronjob (or any other job) can live?

Check out if the previous executed script is still running, if so,
kill 'giftopnm' first or don't start a second one.

something like this:
#!/bin/bash

tempfile="/tmp/tmpfile_giftopnm"

if [ test -r $tempfile ]; then 
	exit
	# or kill the troublemaker:
	kill `pidof giftopnm`
	# or: 
	killall giftopnm
fi

touch $tempfile

<your part of the script here>

rm $tempfile



If you want to make sure the cronjob doesn't kill a giftopnm program the
cronjob didn't start, you'll have to make sure the knows the PID of that
program or script (which was started by cron). You'll probarly have to use
the temperary file to store the PID.


If you want to check it more often, created a new cronjob for this (and a
seperate script), about 10 minutes or so after the main-script started.


HTH

--
Jos Lemmerling on Debian GNU/Linux			jos(@)lemmerling(.net)



-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: process time limit?
  2002-06-26 23:39 process time limit? Jim Reimer
  2002-06-27  0:52 ` Jos Lemmerling
@ 2002-06-27  7:22 ` James Mohr
  1 sibling, 0 replies; 3+ messages in thread
From: James Mohr @ 2002-06-27  7:22 UTC (permalink / raw)
  To: linux-newbie

This does not specifically address your question, but I think this is actually
the answer you wanted:

http://www.linux-tutorial.info/cgi-bin/display.pl?266&0&0&0&3

regards,

jimmo

On Thursday 27 June 2002 01:39, Jim Reimer wrote:
> I have a script run by cron once every half hour which
> gets a RADAR image, does some manipulation on the file,
> and stores it.  It's been running fine for a few weeks
> now.
>
> However, when I got home from work today, the computer
> was *very* sluggish, and 'ps' showed many many instances
> of both the script and 'giftopnm' (one of the programs
> used in the script).  I don't know what went wrong, but
> giftopnm was hanging and not allowing the script to
> complete.
>
> So - is there any way to limit the amount of time a
> cronjob (or any other job) can live?

-- 

---------------------------------------
"Be more concerned with your character than with your reputation. Your
character is what you really are while your reputation is merely what others
thing you are." -- John Wooden
---------------------------------------
Be sure to visit the Linux Tutorial:  http://www.linux-tutorial.info
---------------------------------------
NOTE: All messages sent to me in response to my posts to newsgroups or forums
are subject to reposting.
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-06-27  7:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-06-26 23:39 process time limit? Jim Reimer
2002-06-27  0:52 ` Jos Lemmerling
2002-06-27  7:22 ` James Mohr

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.