aboutsummaryrefslogtreecommitdiff
path: root/jobs/check-backup-of-email.run
blob: 67f4cf64269ad342f9af05eb58b723f64ac55cae (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
#!/usr/bin/env bash
set -euo pipefail

todays_backup="s3://qkbackup/email/$(date "+%w")/"
echo "Check $todays_backup."
output="$(guix environment --ad-hoc python2-s3cmd -- s3cmd ls "$todays_backup")"

# UTC の時刻で日付が当日の場合はバックアップに成功していると見做す
echo "$output" |\
    awk -v utc_today="$(TZ=UTC date "+%F")" \
        '$1 != utc_today && $3 > 0 { print "Failed!"; exit 1 } ; { print }'