diff options
author | crupest <crupest@outlook.com> | 2022-11-23 20:06:23 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2022-11-23 20:06:23 +0800 |
commit | f47f7802424efdbef6006d1e31f9b6840f1f13ab (patch) | |
tree | 4688d77820194213887a7b2c2a615ec63b67848f /docker/auto-backup/daemon.bash | |
parent | d22287917ce6500641beeb36675d61adf071a2f0 (diff) | |
download | crupest-f47f7802424efdbef6006d1e31f9b6840f1f13ab.tar.gz crupest-f47f7802424efdbef6006d1e31f9b6840f1f13ab.tar.bz2 crupest-f47f7802424efdbef6006d1e31f9b6840f1f13ab.zip |
Fix coscli.
Diffstat (limited to 'docker/auto-backup/daemon.bash')
-rwxr-xr-x | docker/auto-backup/daemon.bash | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/docker/auto-backup/daemon.bash b/docker/auto-backup/daemon.bash index 5dd8cfe..c2b91f9 100755 --- a/docker/auto-backup/daemon.bash +++ b/docker/auto-backup/daemon.bash @@ -14,16 +14,9 @@ fi xz --version tar --version -bucket_yaml=$(yq ".buckets[] | select(.alias == \"crupest-backup\")" ~/.cos.yaml) - -# check bucket_yaml is not empty -if [[ -z "$bucket_yaml" ]]; then - echo "Bucket crupest-backup not found. Please check your coscli config." 1>&2 - exit 1 -fi - -bucket_name=$(echo "$bucket_yaml" | yq ".name") -bucket_region=$(echo "$bucket_yaml" | yq ".region") +# do not echo next command +/coscli set --secret_id "${CRUPEST_AUTO_BACKUP_COS_SECRET_ID}" --secret_key "${CRUPEST_AUTO_BACKUP_COS_SECRET_KEY}" +/coscli add --alias "crupest-backup" --bucket "${CRUPEST_AUTO_BACKUP_BUCKET_NAME}" --region "${CRUPEST_AUTO_BACKUP_COS_REGION}" function backup { # Output "Begin backup..." in yellow and restore default @@ -42,8 +35,8 @@ function backup { destination="cos://crupest-backup/$current_time.tar.xz" echo "Use coscli to upload data to $destination ..." - echo "Bucket name: $bucket_name" - echo "Bucket region: $bucket_region" + echo "Bucket name: ${CRUPEST_AUTO_BACKUP_BUCKET_NAME}" + echo "Bucket region: ${CRUPEST_AUTO_BACKUP_COS_REGION}" # upload to remote /coscli cp /tmp/data.tar.xz "$destination" |