From: mwolson_admin Date: Fri, 27 Jun 2008 14:10:36 +0000 (-0400) Subject: s3: Display additional messages, sleep before retrying. X-Git-Url: http://git.hcoop.net/clinton/scripts.git/commitdiff_plain/8862af6d48b78cf6cf055dec506e02704dbf141c s3: Display additional messages, sleep before retrying. --- diff --git a/s3 b/s3 index 9ca45f8..9601162 100755 --- 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 } diff --git a/s3.common b/s3.common index 87338c6..f5f2361 100644 --- a/s3.common +++ b/s3.common @@ -1,3 +1,4 @@ +# -*- Shell-Script -*- # Common functions for dealing with Amazon S3. # units for BWLIMIT are KB/s @@ -41,8 +42,10 @@ function move_over () { local subdir=$1 local file=$2 local dest=$BACKUPDIR/$subdir + local ret split -d -b ${CHUNKSIZE}m - ${file}. for i in ${file}.*; do + echo "Transferring $i to S3 ..." s3_cmd put $dest/$i $i rm -f $i done