linux_backups
Local tar/rsync script:
#!/usr/bin/perl -w # backup_rsync.pl # Script using rsync to backup directories to 2nd local hard disk # /boot/ # /etc/ # /home/ # /root/ # /usr/local/ # /var/lib/mysql/ # /var/spool/cron/ # /var/www/html/ $LOG = "/tmp/backup_rsync"; `/usr/bin/rsync -avz --delete --progress /awips/ /disk2/awips/ >$LOG.awips.log 2>&1`; `/usr/bin/rsync -avz --delete --progress /AWIPS/ /disk2/AWIPS/ >$LOG.AWIPS.log 2>&1`; `/usr/bin/rsync -avz --delete --progress /data/ /disk2/data/ >$LOG.data.log 2>&1`; `/usr/bin/rsync -avz --delete --progress /dev/ /disk2/dev/ >$LOG.dev.log 2>&1`; `/usr/bin/rsync -avz --delete --progress /boot/ /disk2/boot/ >$LOG.boot.log 2>&1`; `/usr/bin/rsync -avz --delete --progress /etc/ /disk2/etc/ >$LOG.etc.log 2>&1`; `/usr/bin/rsync -avz --delete --progress /home/ /disk2/home/ >$LOG.home.log 2>&1`; `/usr/bin/rsync -avz --delete --progress /root/ /disk2/root/ >$LOG.root.log 2>&1`; `/usr/bin/rsync -avz --delete --progress /usr/local/ /disk2/usr/local/ >$LOG.usr.local.log 2>&1`; `/usr/bin/rsync -avz --delete --progress /var/lib/mysql/ /disk2/var/lib/mysql/ >$LOG.var.lib.mysql.log 2>&1`; `/usr/bin/rsync -avz --delete --progress /var/spool/cron/ /disk2/var/spool/cron/ >$LOG.var.spool.cron.log 2>&1`; `/usr/bin/rsync -avz --delete --progress /var/www/html/ /disk2/var/www/html/ >$LOG.var.www.html.log 2>&1`;
The associated cron entry:
# do local backups 30 02 * * * /root/bin/backup_rsync.pl >> /tmp/backup_rsync.log 2>&1 # something to check #* * * * * [ ! -f /tmp/lockFile ] && { touch /tmp/lockRsync ; /root/bin/backup_rsync.pl >> /tmp/backup_rsync.log 2>&1 ; rm /tmp/lockRsync }
linux_backups.txt · Last modified: 2012/06/07 17:22 by juckins