Run and kill program after specific time

Run and kill program after specific time

am 07.01.2008 16:21:18 von yatsek

Hi there.
Is there any simple way to allow program running for specific time and
then just kill it? I.e. like :

$> time ./script.sh

gives how long script was running I would like to have sth. like let's
say command "timer":

$> timer 10m ./script.sh

Which would allow script to be alive for 10 minutes and then it would
kill it. Is it possible to do this some easy way or I need to kill it
manually from other script?

Greetings
Yatsek

Re: Run and kill program after specific time

am 07.01.2008 16:28:39 von Cyrus Kriticos

yatsek@gmail.com wrote:
>
> Is there any simple way to allow program running for specific time and
> then just kill it? I.e. like :
>
> $> time ./script.sh
>
> gives how long script was running I would like to have sth. like let's
> say command "timer":
>
> $> timer 10m ./script.sh
>
> Which would allow script to be alive for 10 minutes and then it would
> kill it. Is it possible to do this some easy way or I need to kill it
> manually from other script?

http://groups.google.de/group/comp.unix.shell/msg/9fc8302532 2c7c86

--
Best regards | Be nice to America or they'll bring democracy to
Cyrus | your country.

Re: Run and kill program after specific time

am 07.01.2008 16:52:27 von yatsek

On Jan 7, 4:28=A0pm, Cyrus Kriticos
wrote:
> yat...@gmail.com wrote:
>
>
> http://groups.google.de/group/comp.unix.shell/msg/9fc8302532 2c7c86
>

yupi!!! works :)

Big thx

--
Yatsek

Re: Run and kill program after specific time

am 27.01.2008 01:11:41 von strombrg

On Mon, 07 Jan 2008 16:28:39 +0100, Cyrus Kriticos wrote:

> yatsek@gmail.com wrote:
>>
>> Is there any simple way to allow program running for specific time and
>> then just kill it? I.e. like :
>>
>> $> time ./script.sh
>>
>> gives how long script was running I would like to have sth. like let's
>> say command "timer":
>>
>> $> timer 10m ./script.sh
>>
>> Which would allow script to be alive for 10 minutes and then it would
>> kill it. Is it possible to do this some easy way or I need to kill it
>> manually from other script?
>
> http://groups.google.de/group/comp.unix.shell/msg/9fc8302532 2c7c86



Here's a program I wrote to do the same thing:

http://stromberg.dnsalias.org/~strombrg/maxtime.html

....but glancing at the other one, I believe mine will:
1) Be more granular - not necessarily a good thing
2) Be less busy-waiting - means less CPU load

I've used in a number of contexts, including with NFS hard mounts from
unreliable servers.