[projects/distfiles] Do few scp retries with a delay.
arekm
arekm at pld-linux.org
Mon Dec 1 07:26:12 CET 2025
commit 934e5ac10a4af1a26bba287a3545cc16d24af5de
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date: Mon Dec 1 07:26:04 2025 +0100
Do few scp retries with a delay.
file-fetcher.pl | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
---
diff --git a/file-fetcher.pl b/file-fetcher.pl
index c239356..827c328 100755
--- a/file-fetcher.pl
+++ b/file-fetcher.pl
@@ -120,15 +120,21 @@ sub copy_to_df($$)
{
my ($from, $to) = @_;
my $cmd = "scp -pr -B -q $from $df_scp/$to";
- open(E, "$cmd 2>&1 |") or fatal("$cmd failed");
my $oops = "";
- while (<E>) {
- $oops .= $_;
- }
- $oops .= "\nThe command has exited with a non-zero status."
+ my $delay = 15;
+ for (my $i = 0; $i < 5; $i++) {
+ $oops = "";
+ open(E, "$cmd 2>&1 |") or fatal("$cmd failed");
+ while (<E>) {
+ $oops .= $_;
+ }
+ $oops .= "\nThe command has exited with a non-zero status."
unless (close (E));
- $problems .= "scp problems: $cmd:\n$oops\n"
- if ($oops ne "");
+ last if ($oops eq "" || $i == 4);
+ sleep($delay);
+ $delay *= 2;
+ }
+ $problems .= "scp problems: $cmd:\n$oops\n" if ($oops ne "");
syslog("err","copy_to_df oops for '$cmd': $oops") if ($oops ne "");
return ($oops ne "");
}
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/projects/distfiles.git/commitdiff/934e5ac10a4af1a26bba287a3545cc16d24af5de
More information about the pld-cvs-commit
mailing list