mirror of
https://github.com/FAUSheppy/athq-vm-management
synced 2025-12-09 15:08:31 +01:00
add: offline backup script
This commit is contained in:
37
backup.sh
Executable file
37
backup.sh
Executable file
@@ -0,0 +1,37 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
echo "Doing $1"
|
||||||
|
TEST=$(python3 -c "print(int('$TYPE' in ['size_changed', 'no_high_data', 'minimal', ''])^1)")
|
||||||
|
if [ $TEST -ne 0 ]; then
|
||||||
|
echo Bad Filter Option [$TYPE]
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# check if we are root
|
||||||
|
test $(whoami) = root
|
||||||
|
|
||||||
|
# mount backup disk
|
||||||
|
udisksctl unlock --key-file udisk.pass -b /dev/sda1
|
||||||
|
udisksctl mount -b /dev/dm-2
|
||||||
|
|
||||||
|
# pull newest git
|
||||||
|
cd ~/athq-vm-management
|
||||||
|
git pull
|
||||||
|
cd config
|
||||||
|
git pull
|
||||||
|
cd ..
|
||||||
|
cd ansible
|
||||||
|
git pull
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
# create backup script
|
||||||
|
eval `ssh-agent`
|
||||||
|
ssh-add ~/.ssh/sheppymaster
|
||||||
|
rm -rf ~/athq-vm-management/build/backup/*
|
||||||
|
python main.py --skip-nginx --skip-icinga --skip-ansible --skip-ssh-config --backup
|
||||||
|
|
||||||
|
TARGET=/media/root/bd358053-84a3-498c-9109-cc4f4d5c10d8/sheppy/new_server/
|
||||||
|
rm "${TARGET}rsync-*"
|
||||||
|
cp ~/athq-vm-management/build/backup/* $TARGET
|
||||||
|
cd $TARGET
|
||||||
|
./wrapper $1
|
||||||
Reference in New Issue
Block a user