Backup

Aus MeinWiki
Wechseln zu: Navigation, Suche

Rdiff Backup

Script

#!/bin/bash
logPath1=/var/log/backup/
logFile1=backup$(date "+%y%m%d").log
fileWrite1=$logPath1$logFile1

mount -t cifs -o username="USERNAME",password="PAASWORT" //172.30.4.12/backup /mnt/backup

if [ -f /mnt/backup/mount ]; then
        echo $(date "+%y%m%d-%H%M%S")' Start Backup' >> $fileWrite1
        rdiff-backup --exclude-symbolic-links /mnt/daten1/bereich/ /mnt/backup/daten1/bereich/ >> $fileWrite1
        rdiff-backup --exclude-symbolic-links /mnt/daten1/home/ /mnt/backup/daten1/home >> $fileWrite1
        rdiff-backup --exclude-symbolic-links /mnt/daten1/profile /mnt/backup/daten1/profile >> $fileWrite1
        rdiff-backup --exclude-symbolic-links /mnt/daten1/exchange /mnt/backup/daten1/exchange >> $fileWrite1
        /etc/init.d/postgresql stop
        rdiff-backup --exclude-symbolic-links /var/lib/postgresql/9.3/main /mnt/backup/var >> $fileWrite1
        /etc/init.d/postgresql start
        logger "Externes Backup Erfolgreich"
        echo $(date "+%y%m%d-%H%M%S")' Stop Backup' >> $fileWrite1
else
        echo $(date "+%y%m%d-%H%M%S")' Error Backup' >> $fileWrite1
        logger "Fehler externes Backup"
fi

umount /mnt/backup