From f8c2d5c6fcd9dc3b1e003cde9a87dc0af9338737 Mon Sep 17 00:00:00 2001 From: mwolson_admin Date: Wed, 25 Jun 2008 00:25:54 -0400 Subject: [PATCH] s3: Implement bandwidth limit. --- s3 | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/s3 b/s3 index aa6a075..9132845 100755 --- a/s3 +++ b/s3 @@ -122,12 +122,14 @@ s3_curl() { # $2 = remote bucket. # $3 = remote name # $4 = local name. + # $5 = bandwidth limit. local bucket remote date sig md5 arg inout headers # 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. stdopts="--connect-timeout 10 --fail --silent" [[ $CURL_S3_DEBUG == true ]] && stdopts="${stdopts} --show-error --fail" + test -n "${5}" && stdopts="${stdopts} --limit-rate ${5}" case "${1}" in GET) arg="-o" inout="${4:--}" # stdout if no $4 ;; @@ -163,7 +165,8 @@ s3_put() { # $1 = remote bucket to put it into # $2 = remote name to put # $3 = file to put. This must be present if $2 is. - s3_curl PUT "${1}" "${2}" "${3:-${2}}" + $ $4 = bandwidth limit. + s3_curl PUT "${1}" "${2}" "${3:-${2}}" "${4}" return $? } @@ -172,7 +175,8 @@ s3_get() { # $2 = remote file to get # $3 = local file to get into. Will be overwritten if it exists. # If this contains a path, that path must exist before calling this. - s3_curl GET "${1}" "${2}" "${3:-${2}}" + $ $4 = bandwidth limit. + s3_curl GET "${1}" "${2}" "${3:-${2}}" "${4}" return $? } -- 2.20.1