====== oVirt - Engine backup ======
mkdir /var/log/engine-backup
vi /etc/logrotate.d/engine-backup
"/var/log/engine-backup/*.log {
daily
missingok
compress
nocreate
rotate 30
}
mkdir /backup
vi /backup/backup.sh
#!/bin/sh
#-----------------------#
# Konfigurace #
#-----------------------#
LOCAL_BACKUP_DIR="/backup" # Lokalni slozka pro zalohy s koncovym lomitkem (/home/backup/)
OF=$LOCAL_BACKUP_DIR/*.bak # jmeno souboru se zalohou
KEY="/backup/.ssh/id_rsa" # cesta k ssh klici pro prihlaseni na backupserver
HOST="172.27.x.x"
REMOTE_BACKUP_DIR="./G3-engine-backup/" # tento adresar musi na cilovem serveru jiz existovat
#---------------------------------------#
# Provest zalohu enginu #
#---------------------------------------#
/usr/bin/engine-backup --mode=backup --scope=all --file=/backup/$(date +"%Y-%m-%d")_G3-engine-backup.bak --log=/var/log/engine-backup/$(date +"%Y-%m-%d")_engine-backup.log
#---------------------------------------#
# Kopirovat zalohu na server #
#---------------------------------------#
/usr/bin/scp -i $KEY $OF $USER@$HOST:$REMOTE_BACKUP_DIR
#-----------------------------------------------#
# Uklid Starych lokalnich souboru #
#-----------------------------------------------#
/bin/rm $OF
Nakopírovat SSH klíče na engine do složky /backup/.ssh
chmod a+x /backup/backup.sh
crontab -e
...
30 23 * * * /backup/bkvoip.sh
...