Backup processen tager ca 2 timer, hvoraf rsync er tidrøveren, så derfor mangler der især proces logging, så jeg i mellemtiden kan følge med i status.
Nogen tips til dette?
her er mit simple basale script:
Kode: Vælg alt
#!/bin/bash
# Backup af Zarafa2
# Procedure:
# Nedlukker VM -> cloner -> starter -> kopier clon til backupserver placering.
#
#
#
#
# Sletter og Gemmer gamle log filer
rm /var/log/backup-vm.log.10
mv /var/log/backup-vm.log.9 /var/log/backup-vm.log.10
mv /var/log/backup-vm.log.8 /var/log/backup-vm.log.9
mv /var/log/backup-vm.log.7 /var/log/backup-vm.log.8
mv /var/log/backup-vm.log.6 /var/log/backup-vm.log.7
mv /var/log/backup-vm.log.5 /var/log/backup-vm.log.6
mv /var/log/backup-vm.log.4 /var/log/backup-vm.log.5
mv /var/log/backup-vm.log.3 /var/log/backup-vm.log.4
mv /var/log/backup-vm.log.2 /var/log/backup-vm.log.3
mv /var/log/backup-vm.log.1 /var/log/backup-vm.log.2
mv /var/log/backup-vm.log /var/log/backup-vm.log.1
# Saetter variabler til log
mylog=/var/log/backup-vm.log
# 1. Saetter Zarafa2 i dvale
echo "$(date +%c) Gemmer Zarafa2" >> $mylog
sudo -u thomas /usr/bin/VBoxManage controlvm Zarafa2 savestate && echo "$(date +%c) Sat i dvale udfort" >> $mylog
sleep 5
rm /home/thomas/Backup/Zarafa2/Zarafa2.ovf.3
mv /home/thomas/Backup/Zarafa2/Zarafa2.ovf.2 /home/thomas/Backup/Zarafa2/Zarafa2.ovf.3
mv /home/thomas/Backup/Zarafa2/Zarafa2.ovf.1 /home/thomas/Backup/Zarafa2/Zarafa2.ovf.2
mv /home/thomas/Backup/Zarafa2/Zarafa2.ovf /home/thomas/Backup/Zarafa2/Zarafa2.ovf.1
rm /home/thomas/Backup/Zarafa2/Zarafa2.vmdk.3
mv /home/thomas/Backup/Zarafa2/Zarafa2.vmdk.2 /home/thomas/Backup/Zarafa2/Zarafa2.vmdk.3
mv /home/thomas/Backup/Zarafa2/Zarafa2.vmdk.1 /home/thomas/Backup/Zarafa2/Zarafa2.vmdk.2
mv /home/thomas/Backup/Zarafa2/Zarafa2.vmdk /home/thomas/Backup/Zarafa2/Zarafa2.vmdk.1
2. Eksporter til Zarafa2.ovf, Zarafa2.vf, Zarafa2.vmdk
echo "$(date +%c) Eksporterer Zarafa2" >> $mylog
sudo -u thomas /usr/bin/VBoxManage export Zarafa2 --output /home/thomas/Backup/Zarafa2/Zarafa2.ovf 2>&1 >> $mylog &&
echo "$(date +%c) Eksportering udfort" >> $mylog
3. Start Zarafa2 igen (undgaa nedetid)
echo "$(date +%c) Starter Zarafa2" >> $mylog
sudo -u thomas /usr/bin/VBoxManage startvm Zarafa2 -type vrdp && echo "$(date +%c) Zarafa2 startet igen" >> $mylog
4. Rsync til Backup server
echo "$(date +%c) Rsync Zarafa2 til backup server" >> $mylog
sudo -u thomas rsync -v -a -e ssh /home/thomas/Backup/Zarafa2 thomas@hostname:/home/thomas/Backup/ >> $mylog
echo "$(date +%c) Backup sendt til backupserver" >> $mylog
echo "$(date +%c) Backup process af Zarafa2 udfort" >> $mylog
# ********************************************