> Luke,
> 
> Nope, this was the exact thing we were trying to get away 
> from.  Suppose I
> don't have space to store that file on the host box.  We're 
> doing it in
> stages now and I really want to get away from that since it 
> increases disk
> activity on the host box during a full backup.  Considering 
> these are web
> servers I want to keep the disk activity as low as possible during the
> backup, if for nothing else than saving the wear and tear on 
> these disks
> that are spinning 24/7/365 as it is.  We almost moved the 
> gzip to the backup
> server also but then we decided that that would put too much 
> burden on the
> backup server it's self (since the backup server may actually 
> be backing up
> multiple servers at a time).  I can do this on the command line with a
> simple:
> 
> ssh 1.1.1.1 "tar -cf - /home/$user | gzip" > /tmp/$user.tar.gz
> 
> It seems to go straight to disk then, but I didn't like the 
> idea of using
> that type of redirect here (and I'm not even sure if it's 
> possible to do
> that properly in a perl script, besides that's not a very 
> 'perl' way of
> doing it :-).

Well, the Net::SSH module is only a wrapper around the ssh program, and
it currently doesn't support sending the output of the command to a
file. If you look in the SSH module at the ssh() routine, you'll see
that it actually uses system() to run your command:

sub ssh {
  my($host, @command) = @_;
  @ssh_options = &_ssh_options unless @ssh_options;
  my @cmd = ($ssh, @ssh_options, $host, @command);
  warn "[Net::SSH::ssh] executing ". join(' ', @cmd). "\n"
    if $DEBUG;
  system(@cmd);
}

You could hack the above to do what you want, for instance if you add a
filehandle as an argument it could write ssh's stdout to that
filehandle.

Now, with the Net::SSH::Perl module, you might be able to use the sock()
routine to write/read data:

use Net::SSH::Perl;
my $ssh = Net::SSH::Perl->new('1.1.1.1');
$ssh->login($user, $pass);
my $socket = $ssh->sock();

# do stuff with socket here - write your command to the socket, and read
the response to a file

Luke

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to