Beispiel einer Backuplösung
Backup erstellen
#!/bin/bash
STATUS=`mount | grep /mnt/backup `
if [ "$STATUS" != "" ]; then
sh /backup/run.sh
fi
#!/bin/bash
DATUM=$(date "+%d%m%y")
/usr/bin/rsync -av --delete /boot/ /mnt/sdc1/boot/.
/usr/bin/rsync -av --delete /etc/ /mnt/sdc1/etc/.
/usr/bin/rsync -av --delete /backup/ /mnt/sdc1/backup/.
/usr/bin/rsync -av --delete /home/ /mnt/sdc1/home/.
/usr/bin/rsync -av --delete /gemeinsam/ /mnt/sdc1/gemeinsam/.
/usr/bin/rsync -av --delete /srv/ /mnt/sdc1/srv/.
/usr/bin/rsync -av --delete /var/lib/samba/ /mnt/sdc1/var/lib/samba/.
/usr/bin/rsync -av --delete /var/spool/cron/ /mnt/sdc1/cron/.
/usr/sbin/slapcat > /mnt/sdc1/ldap_$DATUM.ldif
/usr/bin/mysqldump --all-databases -u root -popen23 > /mnt/sdc1/mysql_$DATUM.sql
crontab -e
#min hour day month dow command
# Samstags um 3 Uhr sichern
0 3 * * 6 /backup/cron.sh
Backup wiederherstellen
#!/bin/bash
rcapache2 stop
rcmysql stop
rcsmb stop
rcnmb stop
rcldap stop
/usr/bin/rsync -av --delete /mnt/sdc1/boot/ /boot/.
/usr/bin/rsync -av --delete /mnt/sdc1/etc/ /etc/.
/usr/bin/rsync -av --delete /mnt/sdc1/backup/ /backup/.
/usr/bin/rsync -av --delete /mnt/sdc1/home/ /home/.
/usr/bin/rsync -av --delete /mnt/sdc1/gemeinsam/ /gemeinsam/.
/usr/bin/rsync -av --delete /mnt/sdc1/srv/ /srv/.
/usr/bin/rsync -av --delete /mnt/sdc1/var/lib/samba/. /var/lib/samba/.
/usr/bin/rsync -av --delete /mnt/sdc1/cron/ /var/spool/cron/.
/usr/sbin/slapcat -v -l /mnt/sdc1/ldap_XXXXXX.ldif
/usr/bin/mysql -u root -popen23 < /mnt/sdc1/mysql_XXXXXX.sql
rcldap start
rcapache2 start
rcmysql start
rcsmb start
rcnmb start