Files
backup-scripts/start-backup.sh
2025-08-26 22:49:19 +02:00

29 lines
688 B
Bash
Executable File

#!/bin/bash
echo "starting backup at $(date)"
is_online="offline"
if ping -W 1 -c 1 10.10.100.52 > /dev/null 2>&1; then
is_online="online"
fi
echo "sending start command"
curl "http://10.10.100.12:8123/startbackup"
if [ "$is_online" = "online" ]; then
echo "VM already online"
else
echo "backups VM was offline! It's starting up now..."
echo "waiting 30 seconds for the VM to start up..."
sleep 30
fi
is_online_after_cmd=$(ping -W 1 -c 1 10.10.100.52)
if [ "$?" == "1" ]; then
echo "Backups VM is still offline!"
curl "http://10.10.100.12:8123/stopbackup"
exit 1
fi
echo "backups VM is online! Continuing with backup"