in reply to How to tail file on remote host
use Net::SFTP::Foreign; use Fcntl qw(SEEK_END); my $host = ...; my $file = ...; my $sftp = Net::SFTP::Foreign->new($host); $sftp->error and die "Unable to connect to remote host: ".$sftp->error +."\n"; my $fh = $sftp->open($file) or die "Unable to open file $file: ".$sftp->error."\n"; # go to end of file seek($fh, 0, SEEK_END); my $sleep = 1; while (1) { while (<$fh>) { print; $sleep = 1; } sleep $sleep; $sleep++ unless $sleep > 5; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to tail file on remote host
by wmarquette (Initiate) on Oct 01, 2008 at 19:51 UTC | |
by salva (Canon) on Oct 01, 2008 at 20:06 UTC | |
by wmarquette (Initiate) on Oct 01, 2008 at 20:30 UTC | |
by salva (Canon) on Oct 01, 2008 at 20:43 UTC |