#!/usr/bin/env bash
# update_crontab.sh — post-migration crontab update for Marius.
# Replaces the clawd/tools/backup_config.sh line with the echo-core equivalent.
# Idempotent: safe to re-run.
set -euo pipefail
current=$(crontab -l 2>/dev/null || true)
new=$(printf '%s\n' "$current" | sed -E 's#/home/moltbot/clawd/tools/backup_config\.sh#/home/moltbot/echo-core/tools/backup_config.sh#g')
if [ "$current" != "$new" ]; then
  printf '%s\n' "$new" | crontab -
  echo "Crontab updated: backup_config.sh path remapped to echo-core."
else
  echo "Crontab unchanged (already pointing at echo-core, or backup_config line absent)."
fi
