Operating System - HP-UX
1833262 Members
3007 Online
110051 Solutions
New Discussion

Help me debugging this .....

 
Enrico Venturi
Super Advisor

Help me debugging this .....

Hello colleagues.
I've found a problem running this PERL script but I cannot still understand what kind of problem exactly.
The script should copy a file in a gzipped format; to do this the script gzip the file, then write it to a remote socket.
The problem is either inside the gzipping or inside the remote transfer ...
Sometimes the file isn't fully copied in the remote host; it seems that the gzip is interrupted or the remote transfer is interrupted.
The right remote file size is 65536; sometimes only 44361 are copied.
Please see the branch of the PERL program; we are in the "compress" case.... maybe some environmental variable is exhausted??

my($in) = gensym();
my($out) = gensym();
my($err) = gensym();

my $currFile;
foreach $currFile (@files) {
if ($compress eq "compress") {
my($pid) = open3($in, $out, "", "/usr/contrib/bin/gzip -c $currFile");
} else {
open($out, "<$currFile");
}

# Write the content to the local file.
my $currRemoteFile;
my $isdir = RemoteExec($host, "\[ -d $remoteFile ]\ \&\& echo 0 \|\| echo 1", $user, $system, $instance);
chomp $$isdir[0];
if ($$isdir[0] eq "0") {
$currRemoteFile = $remoteFile . "/" . basename($currFile);
} else {
$currRemoteFile = $remoteFile;
}

if ($compress eq "compress") {
my $hnd = RemoteWriteFromArray($host, "${currRemoteFile}.gz", $user, $group, $mode, undef, $system, $in
stance, "NOBUFFER");
while (<$out>) {
print $hnd $_;
}