Run and kill program after specific time

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
yatsek [ Mo, 07 Januar 2008 16:21 ] [ ID #1901428 ]

Re: Run and kill program after specific time

yatsek [at] 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.
Cyrus Kriticos [ Mo, 07 Januar 2008 16:28 ] [ ID #1901429 ]

Re: Run and kill program after specific time

On Jan 7, 4:28=A0pm, Cyrus Kriticos <cyrus.kriti... [at] googlemail.com>
wrote:
> yat... [at] gmail.com wrote:
>
>
> http://groups.google.de/group/comp.unix.shell/msg/9fc8302532 2c7c86
>

yupi!!! works :)

Big thx

--
Yatsek
yatsek [ Mo, 07 Januar 2008 16:52 ] [ ID #1901431 ]

Re: Run and kill program after specific time

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

> yatsek [at] 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.
strombrg [ So, 27 Januar 2008 01:11 ] [ ID #1917106 ]
Linux » comp.unix.shell » Run and kill program after specific time

Vorheriges Thema: KSH Version
Nächstes Thema: run script as a user(ex: user1) at boot time