diff options
author | Masaya Tojo <masaya@tojo.tokyo> | 2021-09-14 03:56:25 +0900 |
---|---|---|
committer | Masaya Tojo <masaya@tojo.tokyo> | 2021-09-14 03:56:25 +0900 |
commit | cf45305724b66b5b7cff5198e9001a8e0850f65a (patch) | |
tree | 23b9e04c539a6e3b0229fcef650b363d3af8b671 | |
parent | 1ad99d5b548aa5e2a4d6aca804ea54658ac977f7 (diff) |
check-backup-of-nextcloud: Add.
-rwxr-xr-x | jobs/check-backup-of-nextcloud.run | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/jobs/check-backup-of-nextcloud.run b/jobs/check-backup-of-nextcloud.run new file mode 100755 index 0000000..75b0939 --- /dev/null +++ b/jobs/check-backup-of-nextcloud.run @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +set -euo pipefail + +todays_backup="s3://qkbackup/nextcloud/$(date "+%w")/" +echo "Check $todays_backup." +output="$(guix environment --ad-hoc python2-s3cmd -- s3cmd ls "$todays_backup")" +echo "$output" + +# UTC の時刻で日付が同日の場合はバックアップに成功していると見做す +echo "$output" |\ + awk -v utc_today="$(TZ=UTC date "+%F")" \ + '$1 != utc_today { print "Failed!"; exit 1 }' |