#!/usr/bin/env bash
# CNPERP on-premise license heartbeat (Linux cron)
# */5 * * * * /path/to/cnperp/deploy/local_license_heartbeat.sh >> /var/log/cnperp-heartbeat.log 2>&1

set -euo pipefail
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
CONFIG="${ROOT}/deploy/license-node.json"
PYTHON="${PYTHON:-python3}"

if [[ ! -f "$CONFIG" ]]; then
  echo "Missing $CONFIG — copy from deploy/license-node.example.json"
  exit 1
fi

exec "$PYTHON" "$ROOT/scripts/heartbeat_license.py" --config "$CONFIG"
