rendered paste body#! /bin/bash
LOG="/home/patrick/Log/rsync.log"
INTERVAL="900"
TYPE="device"
ICON="/usr/share/icons/Nuovo/scalable/emblems/emblem-information.svg"
sleep 5
notify-send -i ${ICON} -c ${TYPE} "Synchronization started" "Your files will be synchronized
every ${INTERVAL} seconds"
while [ "a" != "b" ]; do
ICON="/usr/share/icons/Nuovo/scalable/emblems/emblem-important.svg"
echo "`date` Synchronization started" >${LOG}
echo "" >>${LOG}
echo "" >>${LOG}
echo "`date` Starting sync of HOME folder on BOLDERBAST..." >>${LOG}
rsync -r -t -p -o -g -v --delete --delete-excluded --log-file="${LOG}" --exclude='.mozilla/firefox/ot3v81v8.default/Cache/*' --exclude='.java/deployment/cache/*' --exclude='.evolution/cache/*' --exclude='.evolution/mail/groupwise/*' --exclude='.evolution/addressbook/groupwise*' --exclude='.thumbnails/*' --exclude='.viminfo' --exclude='.hellanzb/*' --exclude='BuildServices/*' -l /home/patrick/ omaduck:/home/patrick/Backups/bolderbast
ERROR="${?}"
if [ "${ERROR}" != "0" ] && [ "${ERROR}" != "24" ]; then
notify-send -t ${INTERVAL}000 -i ${ICON} -c ${TYPE} "Rsync failed!" "Rsync of HOME folder on BOLDERBAST failed.
Please check the log file for more information!"
fi
echo "" >>${LOG}
echo "" >>${LOG}
if [ -e /media/ICYBOX ]; then
echo "`date` Starting sync of external disk ICYBOX..." >>${LOG}
rsync -r -t -p -o -g -v --delete --delete-excluded --log-file="${LOG}" -l /media/ICYBOX/ omaduck:/home/patrick/Backups/icybox
ERROR="${?}"
if [ "${ERROR}" != "0" ] && [ "${ERROR}" != "24" ]; then
notify-send -t ${INTERVAL}000 -i ${ICON} -c ${TYPE} "Rsync failed!" "Rsync of external disk ICYBOX failed.
Please check the log file for more information!"
fi
else
echo "`date` External disk ICYBOX is not attached. Skipping synchronization of external disk ICYBOX." >>${LOG}
fi
echo "" >>${LOG}
echo "" >>${LOG}
if [ -e /media/NOVELL ]; then
echo "`date` Starting sync of external disk NOVELL..." >>${LOG}
rsync -r -t -p -o -g -v --delete --delete-excluded --log-file="${LOG}" -l /media/NOVELL/ omaduck:/home/patrick/Backups/novell
ERROR="${?}"
if [ "${ERROR}" != "0" ] && [ "${ERROR}" != "24" ]; then
notify-send -t ${INTERVAL}000 -i ${ICON} -c ${TYPE} "Rsync failed!" "Rsync of external disk NOVELL failed.
Please check the log file for more information!"
fi
else
echo "`date` External disk NOVELL is not attached. Skipping synchronization of external disk NOVELL." >>${LOG}
fi
echo "" >>${LOG}
echo "" >>${LOG}
if [ -e /media/NEXSTAR ]; then
echo "`date` Starting sync of external disk NEXSTAR..." >>${LOG}
rsync -r -t -p -o -g -v --delete --delete-excluded --log-file="${LOG}" --exclude='Backup/*' -l /media/NEXSTAR/ omaduck:/home/patrick/Backups/nexstar
ERROR="${?}"
if [ "${ERROR}" != "0" ] && [ "${ERROR}" != "24" ]; then
notify-send -t ${INTERVAL}000 -i ${ICON} -c ${TYPE} "Rsync failed!" "Rsync of external disk NEXSTAR failed.
Please check the log file for more information!"
fi
else
echo "`date` External disk NEXSTAR is not attached. Skipping synchronization of external disk NEXSTAR." >>${LOG}
fi
echo "" >>${LOG}
echo "" >>${LOG}
if [ -e /media/NEXSTAR ]; then
echo "`date` Starting sync of BACKUP on OMADUCK..." >>${LOG}
rsync -r -t -p -o -g -v --delete --delete-excluded --log-file="${LOG}" -l omaduck:/home/backup/ /media/NEXSTAR/Backup
ERROR="${?}"
if [ "${ERROR}" != "0" ] && [ "${ERROR}" != "24" ]; then
notify-send -t ${INTERVAL}000 -i ${ICON} -c ${TYPE} "Rsync failed!" "Rsync of BACKUP on OMADUCK failed.
Please check the log file for more information!"
fi
else
echo "`date` External disk NEXSTAR is not attached. Skipping synchronization of BACKUP on OMADUCK." >>${LOG}
fi
echo "" >>${LOG}
echo "" >>${LOG}
echo "`date` Synchronization finished" >>${LOG}
sleep ${INTERVAL}
done