#!/bin/bash # # Original File # ------------- # http://finmath.uchicago.edu/~wilder/Security/rsync/ # http://Linux-Backup.net/scripts//wilder.rsync.txt # # 01-Oct-05 amo Date-of-Birth # # # # Crontab # ------- # 0 3 1-31/2 * * root /etc/rsync.daily 1 # 0 3 2-31/2 * * root /etc/rsync.daily 2 # # iptables # --------- # "rsynchosts" is a space-separated list of the ip addresses of # # # # # the machines that will be doing the backups. # # # rsynchosts="192.168.1.1 192.168.1.2"; # # # for rsynchost in $rsynchosts; do # iptables -A INPUT -j ACCEPT -p tcp -s $rsynchost --dport 873 # done # # # iptables -A INPUT -j DROP -p tcp --dport 873 # # # # The argument this script is called with, either 1 or 2 ext=$1 # # The full paths of the programs used in this script rsync=/usr/bin/rsync mount=/bin/mount umount=/bin/umount # # Good rsync options for backups. rsync_opts="-av --delete --delete-excluded" # # The name of the file containing the rsync connection password password="--password-file=/etc/.rs_pass" # # A list of files and directories that do not need to be backed up exclude_list="noback/ core .kde/ .gnome/ .netscape/cache/ Cookies/ backup/" excludes="" # for exclude in $exclude_list; do excludes="$excludes --exclude=$exclude" done # # Backup /home on mach1 to /backup/mach1_1/home or # /backup/mach1_2/home depending on the argument the script # was called with. Dump any output and error messages to # /etc/backup/mach1_home_1 or /etc/backup/mach1_home_2 # $rsync $rsync_opts $excludes /home /backup/mach1_${ext}/ > \ /etc/backup/mach1_home_${ext} 2>&1 # # Backup /profiles on mach1 # $rsync $rsync_opts $excludes /profiles /backup/mach1_${ext}/ > \ /etc/backup/mach1_profiles_${ext} 2>&1 # # Backup /etc on mach1 # $rsync $rsync_opts /etc /backup/mach1_${ext}/ > \ /etc/backup/mach1_etc_${ext} 2>&1 # # Backup mach2 and mach3 according to the [rsync] sections # of the rsyncd.conf files on the two machines. Use the # password given in /etc/.rs_pass. # $rsync $rsync_opts $excludes $password mach2::rsync \ /backup/mach2_${ext}/home/ > /etc/backup/mach2_${ext} 2>&1 # $rsync $rsync_opts $excludes $password mach3::rsync \ /backup/mach3_${ext}/home/ > /etc/backup/mach3_${ext} 2>&1 # # ENd of file