Files
backup-scripts/start-backup.sh
2026-02-04 21:28:02 +01:00

27 lines
604 B
Bash
Executable File

#!/bin/bash
echo "starting backup at $(date)"
VM_IP="10.10.100.52"
MAX_WAIT=180
SLEEP_INTERVAL=5
ELAPSED=0
echo "sending start command"
curl -s "http://10.10.100.12:8123/startbackup"
echo "waiting for backups VM to come online..."
while ! ping -W 1 -c 1 "$VM_IP" > /dev/null 2>&1; do
sleep "$SLEEP_INTERVAL"
ELAPSED=$((ELAPSED + SLEEP_INTERVAL))
if [ "$ELAPSED" -ge "$MAX_WAIT" ]; then
echo "Backups VM did not come online within ${MAX_WAIT}s"
curl -s "http://10.10.100.12:8123/stopbackup"
exit 1
fi
done
echo "backups VM is online! Continuing with backup"