#!/bin/bash # rsync_backup.sh # Meryll Larkin June 10,2020 BUP_DEST="/mnt/BACKUPS" exclude_file="/root/bin/CRON/rsync_excludes.txt" error_log="/root/bin/CRON/rsync_error.log" datestring=$(date +"%Y%m%d") if [ -d $BUP_DEST ] ; then if [ -e $exclude_file ] ; then # echo "$BUP_DEST is mounted." rsync -rpt --exclude-from=${exclude_file} /home/ $BUP_DEST rsync -rpt --exclude-from=${exclude_file} /root $BUP_DEST # add more backup sources here else echo "$exclude_file not found." echo "$datestring $exclude_file not found." >>$error_log fi else # echo "$BUP_DEST is NOT mounted." echo "$datestring $BUP_DEST is NOT mounted." >>$error_log fi exit # To create exclude_file: # ls -1d /home//.* # chmod 744