#!/bin/sh set -eu backup_root="${ASSISTANT_BACKUP_DIR:-/home/m/assistant-backups/postgres}" verify_script="${ASSISTANT_RESTORE_VERIFY_SCRIPT:-/home/m/assistant-ops/verify-postgres-restore.sh}" latest="$(find "$backup_root" -mindepth 1 -maxdepth 1 -type d ! -name '.*' -printf '%f\n' | sort | tail -n 1)" if [ -z "$latest" ]; then echo "No completed PostgreSQL backup found in $backup_root" >&2 exit 1 fi exec "$verify_script" "$backup_root/$latest"