From: Enrique Perez-Terron on
On Tue, 22 Apr 2008 19:53:29 +0000, Jahoo wrote:

> Hello
> I would like to make script which:
> will execute specific command (for example tcpdump, tail or something
> like that - with some grep or cut pipes...) - it's of course easy BUT
> i would like this command to be executed for specific time, for example
> an hour and after that it should be stopped.
>
> Can You help me one more time? :>

Not tested:
----8<--- cut here ---8<----
#!/bin/bash
timeout=$1
shift
("$@") &
sleep $timeout
kill -s TERM $!
----8<--- cut here ---8<----
Put the lines above in a file called do-for-seconds, make the file
executable, and run like this

$ ./do-for-seconds 3600 tcpdump -a -b -c otherargs

Regards
From: Tom Newton on
On 2008-04-22, in <fulfnp$ii2$1(a)news.onet.pl> Jahoo <jahoo(a)o2.pl>
wrote:

> Hello I would like to make script which: will execute specific
> command (for example tcpdump, tail or something like that -
> with some grep or cut pipes...) - it's of course easy BUT i
> would like this command to be executed for specific time, for
> example an hour and after that it should be stopped.
>
> Can You help me one more time? :>


You aren't ever going to learn to script if you keep asking
people to do all your work for you.

Start by writing the script you want in psuedo-code:

start app now
record time
check time repeatedly
when it equals beginning time + 90 minutes, stop app.

That looks like it could work if you could do it in bash, right?

Okay. Now you need some good examples of bash scripts. You'll
find a lot of them here:

http://www.tldp.org/LDP/abs/abs-guide.txt.gz

You can get it in html and pdf, but the text version is all one file
and it is very handy to open it in a pager or editor and search
for key words.


Tom


--
The Truth will set you free:
http://www.sethcenter.com

From: pk on
On Tuesday 22 April 2008 21:53, Jahoo wrote:

> Hello
> I would like to make script which:
> will execute specific command (for example tcpdump, tail or something like
> that - with some grep or cut pipes...) - it's of course easy
> BUT
> i would like this command to be executed for specific time, for example an
> hour and after that it should be stopped.
>
> Can You help me one more time? :>

man cron