s3: Display additional messages, sleep before retrying.
[clinton/scripts.git] / s3
diff --git a/s3 b/s3
index 9ca45f8..9601162 100755 (executable)
--- a/s3
+++ b/s3
@@ -5,7 +5,8 @@
 
 CURL=/home/mwolson_admin/bin/curl
 HMAC=$(dirname $0)/s3-hmac
-ATTEMPTS=3
+ATTEMPTS=7
+ATTEMPT_WAIT=10
 
 # print a message and bail
 die() {
@@ -159,12 +160,14 @@ s3_curl() {
   headers[${#headers[@]}]="Date: ${date}"
   [[ ${md5} ]] && headers[${#headers[@]}]="Content-MD5: ${md5}"
   tries=0
-  while test $tries -lt 3; do
+  while test $tries -lt $ATTEMPTS; do
     tries=$(expr $tries + 1)
     $CURL ${arg} "${inout}" ${stdopts} -K <(curl_headers "${headers[@]}") \
        "http://s3.amazonaws.com${bucket}${remote}"
     ret=$?
     test $ret -eq 0 && break; 
+    sleep $ATTEMPT_WAIT
+    echo "Retrying ..."
   done
   return $ret
 }