I've done that, with lock files. When the script starts up it checks for
the lock file, if it exists sleep 1, check until it's gone. In your
case, count how many times it sleeps and kill off the other process with
some fancy use of ps and awk after 20 sleeps, and don't forget to remove
the lock file :)
Donncha.
kevin lyda wrote:
>> ok, let's say i have command foo that i want to run in a shell script.
> foo -h lists the tests foo can do, and foo # will run that test number.
> the snippet might look like so:
>> for test in `foo -h | awk '{print $1}'`; do
> foo $test
> done
>> fine so far. now, for any given test foo shouldn't take more then around
> 10 minutes. how can i kill foo if it takes longer then 20 seconds via
> a shell script. note, this is a bourne shell script and can't take
> advantage of gnu extensions to utils or in bash.
>> kevin
>
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!