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