*nix tail -f multiple log files with Thread
David
david at abbottdavid.com
Fri Feb 13 14:18:11 EST 2009
Joe Riopel wrote:
> On Fri, Feb 13, 2009 at 12:03 PM, David <david at abbottdavid.com> wrote:
>> Hi everyone,
>>
>> I copied a program from C to track multiple log files. I would like to be
>> able to print a label when a log file is updated. Here is the program;
>
> Since you're calling tail itself, why not just use tail's ability to
> tail multiple files? It too will output the label.
>
> I am using tail from the GNU coreutils, version 5.97.
>
> I did the following, using two xterms:
>
> First, in one xterm window:
> $ touch foo bar
> $ tail -f foo bar
>
> Then in another xterm:
> $ echo "Hi foo" > foo
> $ echo "Hi bar" > bar
>
> Back in the first xterm window I see this:
> $ tail -f foo bar
> ==> foo <==
>
> ==> bar <==
>
> ==> foo <==
> Hi foo
>
> ==> bar <==
> Hi bar
>
>
Thanks Joe, sure am glad I asked. Oh well it was good practice as I am
just learning python, I don't know how I missed that I could tail more
than one file.
--
Powered by Gentoo GNU/LINUX
http://www.linuxcrazy.com
pgp.mit.edu
More information about the Python-list
mailing list