Hello everyone,
I am a little new to perl. I am writing a little backup script using
Net::SSH:Perl, Compress::Zlib and FileHandle.
I am just tarring up users in the home directory. ( Ohh I am runnng Linux)
I have most of the script working except Compress standard out from my ssh command.
Can anyone offer any suggestions??
<snip>
foreach $home_user (@home_users) {
my($tar_out, $tar_err) = $ssh->cmd("cd /home; /bin/tar cpf - $home_user");
my $gz_file->gzopen($tar_out, "rb") or die " Cannot open $tar_out: $gzerrno\n";
while (<>) {
$gz_file->gzwrite($_)
or die "error writing: $gzerrno\n" ;
}
my $gz_user = new FileHandle "/backup1/$home_user\.tar.gz", "w";
$gz_user->print($gz_file);
# for error logging...
my $tar_err_log = new FileHandle "/var/log/tar_error.log", "w";
$tar_err_log->print($tar_err);
$tar_err_log->close;
$gz_file->gzclose;
$gz_user->close;
undef $tar_out;
undef $tar_err;
undef $gz_file;
}
</snip>
I can connect fine and just copy the tar ball aver. But I want to gzip the tar ball
also. It keeps on dying saying
Can't call method "gzopen" on an undefined value at tadpole.pl line such and such.
But I thought I defined it when I say my($tar_out, $tar_err) = $ssh
I am stuck.
THanks for the help...
--chad
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]