Running a shell command for a specific period of time

Erik Bixby erik.bixby at gmail.com
Mon Oct 31 08:36:57 MST 2005


I liked Lynn's solution, too. So well, that it's what I'm using. I
installed, and read the man page for, timeout. timeout is exactly what I was
looking for, when I started this project.

Timing isn't all that important. We're looking to see if a specific IP
address is doing anything unbecoming a district employee during working
hours. So, missing a second or two at midnight isn't at all an issue, as no
one would be here that late anyhow.

Thank you everyone for the helpful suggestions!
-Erik

On 10/27/05, der.hans <PLUGd at lufthans.com> wrote:
>
> Am 26. Oct, 2005 schwätzte Erik Bixby so:
>
> > I was wondering if anyone knew a way to allow a shell command to run for
> a
> > specific period of time. In this particular case, I want tcpdump to run
> for
> > 23 hours, 59 minutes, 59 seconds. I couldn't find anything in the
> tcpdump
> > man page that gave me the impression that tcpdump itself has that
> > functionality. And, I couldn't find anything in a quick google search. I
> > also thought it was an interesting scripting trick that I don't know,
> and
> > thought I'd ask you nice folks...
>
> I just ran into timeout.
>
> Description: Run a command with a time limit.
> timeout executes a command and imposes an elapsed time limit. When the
> time limit is reached, timeout sends a predefined signal to the target
> process.
>
> I like Lynn's solution.
>
> You might also just have a cronjob that kills and execs tcpdump at the
> right point.
>
> Presuming the reason you're doing this is to split the log files you might
> want to investigate whether or not you can blip tcpdump to change logfiles
> w/o shutting down.
>
> ciao,
>
> der.hans
> --
> # https://www.LuftHans.com/
> # "So the environment is not a luxury ... It is an economically important
> # insurance policy whose wisdom we ignore at our peril."
> # -- Klaus Toepfer, U.N. environment agency Executive Director
>
> ---------------------------------------------------
> PLUG-discuss mailing list - PLUG-discuss at lists.plug.phoenix.az.us
> To subscribe, unsubscribe, or to change you mail settings:
> http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.plug.phoenix.az.us/pipermail/plug-discuss/attachments/20051031/48e68cf1/attachment.htm


More information about the PLUG-discuss mailing list