문제

How do I verify a copied file on a remote server using Perl SCP or is it possible? Below is the Perl command that I am using. I cannot use SSH so my options are somewhat limited.

$scpe->scp("/u02/oraclebackup/$tar_file","HOST:/u04/orabkup/oraclebackup/oemp/");
도움이 되었습니까?

해결책

Ok I've found a solution to my problem and while it doesn't directly verify the copy it will stop the script if there is an error beside the one that is expected. Here is my code:

$scpe->error_handler( \&scp_errors );
$scpe->scp( "/u02/oraclebackup/$tar_file",
    "HOST:/u04/orabkup/oraclebackup/oemp/" );

#Error trapping with exception for known harmless error
sub scp_errors {
    my $line = shift;

    if ( $line =~ /scp timed out while trying to connect to/ ) { 
        return (0);
    } else {
        return (1);
    }   
}

This seems to have solved both of my problems. Thanks @chrsblck

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top