There's a FAQ that deals with coding a "tail -f" if you're logfile is on the
same box as the perl script.
But what if you want to use rsh to tail a file remotely?

Here's what I have:
------------------------------8<---------------------------------------8<---
--------------------------------

#!/usr/bin/perl -w
use strict;
use Net::Rsh;

my $host = shift or die "usage: my_rsh <hostname> <command>";
my $cmd  = shift or die "usage: my_rsh <hostname> <command>";

my $session = Net::Rsh -> new();

my @output = $session->rsh($host, '<local_user>', '<remote_user>', $cmd) or
die;

for (@output) {print;}

----------------8<----------------------------8<----------------------------
-----------8<----------------

and here's my command line:

$ sudo my_rsh.pl <hostname> "tail -f /u01/app/apache/logs/access_log"

It seems that I never reach the print statement...

I've tried things like:

open(OUTPUT, $session->rsh($host, '<local_user>', '<remote_user>', $cmd) )
or die;
while (<OUTPUT>) {print;}

but that doesn't work.

Can anyone shed some light on this?

Thanks.





-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to