#!/bin/sh # backup healthcheck (SPEC ยง10.2): healthy when /backups/last-success is newer than 26 hours, or when no run is due # yet since the container started (started less than 26 hours ago). limit=$((26 * 3600)) now=$(date +%s) marker=${BACKUP_DIR:-/backups}/last-success if [ -f "$marker" ] && [ $((now - $(stat -c %Y "$marker"))) -lt "$limit" ]; then exit 0 fi if [ -f /tmp/kvitt-started ] && [ $((now - $(cat /tmp/kvitt-started))) -lt "$limit" ]; then exit 0 fi echo "no successful backup in the last 26 hours" exit 1