#!/usr/bin/env bash
##
## run-ensure-whp-crons.sh — reconcile this server's crontab to the canonical
## WHP cron set (re-run each release so drift / newly-canonical entries land).
##
## The stable, rebuild-proof installer lives at scripts/ensure-whp-crons.sh and
## is also invoked by setup.sh on fresh/rebuild. This run picks up the
## now-canonical bichon-archival-sync + sitesmith-spend-alert entries on servers
## that were missing them. Idempotent — only adds entries whose script-invocation
## signature is absent.
set -euo pipefail

INSTALLER=/root/whp/scripts/ensure-whp-crons.sh

if [ ! -f "$INSTALLER" ]; then
    echo "WARN: $INSTALLER not found (release tree not extracted yet?); skipping." >&2
    exit 0
fi

bash "$INSTALLER"
