HCoop
/
clinton
/
scripts.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
6228995
)
s3: Try 3 times on a file before giving up.
author
mwolson_admin
<mwolson_admin@deleuze.hcoop.net>
Wed, 25 Jun 2008 22:37:28 +0000
(18:37 -0400)
committer
mwolson_admin
<mwolson_admin@deleuze.hcoop.net>
Wed, 25 Jun 2008 22:37:28 +0000
(18:37 -0400)
s3
patch
|
blob
|
blame
|
history
diff --git
a/s3
b/s3
index
351bd0d
..
9ca45f8
100755
(executable)
--- a/
s3
+++ b/
s3
@@
-5,6
+5,7
@@
CURL=/home/mwolson_admin/bin/curl
HMAC=$(dirname $0)/s3-hmac
CURL=/home/mwolson_admin/bin/curl
HMAC=$(dirname $0)/s3-hmac
+ATTEMPTS=3
# print a message and bail
die() {
# print a message and bail
die() {
@@
-124,7
+125,7
@@
s3_curl() {
# $3 = remote name
# $4 = local name.
# $5 = bandwidth limit.
# $3 = remote name
# $4 = local name.
# $5 = bandwidth limit.
- local bucket remote date sig md5 arg inout headers
+ local bucket remote date sig md5 arg inout headers
tries ret
# header handling is kinda fugly, but it works.
bucket="${2:+/${2}}/" # slashify the bucket
remote="$(urlenc "${3}")" # if you don't, strange things may happen.
# header handling is kinda fugly, but it works.
bucket="${2:+/${2}}/" # slashify the bucket
remote="$(urlenc "${3}")" # if you don't, strange things may happen.
@@
-157,9
+158,15
@@
s3_curl() {
headers[${#headers[@]}]="Authorization: AWS ${S3_ACCESS_KEY_ID}:${sig}"
headers[${#headers[@]}]="Date: ${date}"
[[ ${md5} ]] && headers[${#headers[@]}]="Content-MD5: ${md5}"
headers[${#headers[@]}]="Authorization: AWS ${S3_ACCESS_KEY_ID}:${sig}"
headers[${#headers[@]}]="Date: ${date}"
[[ ${md5} ]] && headers[${#headers[@]}]="Content-MD5: ${md5}"
+ tries=0
+ while test $tries -lt 3; do
+ tries=$(expr $tries + 1)
$CURL ${arg} "${inout}" ${stdopts} -K <(curl_headers "${headers[@]}") \
"http://s3.amazonaws.com${bucket}${remote}"
$CURL ${arg} "${inout}" ${stdopts} -K <(curl_headers "${headers[@]}") \
"http://s3.amazonaws.com${bucket}${remote}"
- return $?
+ ret=$?
+ test $ret -eq 0 && break;
+ done
+ return $ret
}
s3_put() {
}
s3_put() {