I have a perl script written in Server B to scp a file periodically for every hour from Server A to Server B. The problem is sometimes the scp fails for that particular hour because of some issues on the server B. I want the scp to keep retrying until it succeeds whenever this happens.
The script is:
$soc_scp=`scp -r user\@some_ip:\/home\/hbase\/hourly\/$datehr\.tar\.gz \/home\/hbase\/hourly\/$datehr\.tar\.gz`;
$echo_soc=`echo $?`;
if($echo_soc != 0)
{
$soc_scp=`scp -r user\@some_ip\:\/home\/hbase\/hourly\/$datehr\.tar\.gz \/home\/hbase\/hourly\/$datehr\.tar\.gz`;
}
I have not specified the ip for security reasons.Any help would be much appreciated.