Size GCS with gsutil
This commit is contained in:
parent
8abfd40c30
commit
01143b6834
2 changed files with 27 additions and 2 deletions
|
|
@ -50,6 +50,11 @@ Be sure to make the script executable (`chmod +x`) before you hit the gas.
|
|||
* Basic utilities like: [bash](https://www.gnu.org/software/bash/), [which](http://unixhelp.ed.ac.uk/CGI/man-cgi?which), [find](https://www.gnu.org/software/findutils/) and [tee](http://linux.die.net/man/1/tee) (should already be available on most Linux systems)
|
||||
* [gpg](https://www.gnupg.org/) *`optional`*
|
||||
* [mailx](http://linux.die.net/man/1/mailx) *`optional`*
|
||||
For [Amazon S3](https://aws.amazon.com/s3/) *`optional`*
|
||||
* [s3cmd](http://s3tools.org/s3cmd) *`optional`*
|
||||
For [Google Cloud Storage](https://cloud.google.com/storage/) *`optional`*
|
||||
* [boto](https://github.com/boto/boto)
|
||||
* [gsutil](https://cloud.google.com/storage/docs/gsutil) *`optional`*
|
||||
|
||||
For [Amazon S3](https://aws.amazon.com/s3/) *`optional`*
|
||||
* [s3cmd](http://s3tools.org/s3cmd) *`optional`*
|
||||
|
|
|
|||
|
|
@ -214,6 +214,11 @@ elif [ "$ENCRYPTION" = "no" ]; then
|
|||
ENCRYPT="--no-encryption"
|
||||
fi
|
||||
|
||||
NO_GSCMD="WARNING: gsutil no found in PATH, remote file \
|
||||
size information unavailable."
|
||||
NO_GSCMD_CFG="WARNING: gsutil is not configured, run 'gsutil config' \
|
||||
in order to retrieve remote file size information. Remote file \
|
||||
size information unavailable."
|
||||
NO_S3CMD="WARNING: s3cmd no found in PATH, remote file \
|
||||
size information unavailable."
|
||||
NO_S3CMD_CFG="WARNING: s3cmd is not configured, run 's3cmd --configure' \
|
||||
|
|
@ -228,6 +233,17 @@ fi
|
|||
|
||||
if [ "`echo ${DEST} | cut -c 1,2`" = "gs" ]; then
|
||||
DEST_IS_GS=true
|
||||
GSCMD="$(which gsutil)"
|
||||
if [ ! -x "$GSCMD" ]; then
|
||||
echo $NO_GSCMD; GSCMD_AVAIL=false
|
||||
elif [ ! -f "${HOME}/.boto" ]; then
|
||||
echo $NO_GSCMD_CFG; GSCMD_AVAIL=false
|
||||
else
|
||||
GSCMD_AVAIL=true
|
||||
GSCMD="${GSCMD}"
|
||||
fi
|
||||
else
|
||||
DEST_IS_GS=false
|
||||
fi
|
||||
|
||||
if [ "`echo ${DEST} | cut -c 1,2`" = "s3" ]; then
|
||||
|
|
@ -416,8 +432,10 @@ get_remote_file_size()
|
|||
;;
|
||||
"gs")
|
||||
FRIENDLY_TYPE_NAME="Google Cloud Storage"
|
||||
#TMPDEST=`echo ${DEST} | cut -c 4-`
|
||||
#SIZE=`du -hs ${TMPDEST} | awk '{print $1}'`
|
||||
if $GSCMD_AVAIL ; then
|
||||
TMPDEST=`echo $DEST | sed -e "s/\/*$//" `
|
||||
SIZE=`gsutil du -s ${TMPDEST} | awk '{print $1}'`
|
||||
fi
|
||||
;;
|
||||
"s3")
|
||||
FRIENDLY_TYPE_NAME="S3"
|
||||
|
|
@ -799,6 +817,8 @@ fi
|
|||
|
||||
unset AWS_ACCESS_KEY_ID
|
||||
unset AWS_SECRET_ACCESS_KEY
|
||||
unset GS_ACCESS_KEY_ID
|
||||
unset GS_SECRET_ACCESS_KEY
|
||||
unset PASSPHRASE
|
||||
unset SIGN_PASSPHRASE
|
||||
unset FTP_PASSWORD
|
||||
|
|
|
|||
Loading…
Reference in a new issue