not stop/start machine during backup

This commit is contained in:
egarette@silique.fr 2023-06-22 15:51:16 +02:00
parent 44eb0031de
commit 120af2ff01

View file

@ -1,6 +1,5 @@
#!/bin/bash -e #!/bin/bash -ex
#START=$1
BACKUP_DIR="/root/backup" BACKUP_DIR="/root/backup"
MACHINES="" MACHINES=""
@ -15,23 +14,14 @@ done
cd /var/lib/risotto/srv/ cd /var/lib/risotto/srv/
mkdir -p "$BACKUP_DIR" mkdir -p "$BACKUP_DIR"
for machine in $MACHINES; do for machine in $MACHINES; do
# machinectl stop $machine || true
# while true; do
# machinectl status "$machine" > /dev/null 2>&1 || break
# sleep 1
# done
BACKUP_FILE="$BACKUP_DIR/backup_$machine.tar.bz2" BACKUP_FILE="$BACKUP_DIR/backup_$machine.tar.bz2"
rm -f "$BACKUP_FILE" rm -f "$BACKUP_FILE"
if [ -f "/var/lib/risotto/configurations/$machine/sbin/risotto_backup" ]; then if [ -f "/var/lib/risotto/configurations/$machine/sbin/risotto_backup" ]; then
machinectl -q shell $machine /usr/local/lib/sbin/risotto_backup machinectl -q shell $machine /usr/local/lib/sbin/risotto_backup
tar -cJf $BACKUP_FILE $machine/backup tar --ignore-failed-read -cJf $BACKUP_FILE $machine/backup
else elif [ ! -f "/var/lib/risotto/configurations/$machine/no_risotto_backup" ]; then
tar -cJf $BACKUP_FILE $machine tar --ignore-failed-read -cJf $BACKUP_FILE $machine
fi fi
done done
#if [ -z "$START" ]; then
# machinectl start $MACHINES
#fi
exit 0 exit 0