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

todays_backup="s3://qkbackup/jupyter-notebook/$(date "+%d")/"
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 }'