Hi to All,
The idea is to have a crontab in order to run a script that backs up my local files to my remote server. The problem is that if there are too many files to transfer (Example: I ripped a DVD in the last hour) the actual backup may take longer than 60 minutes. So I want to make script to check if my backup script, based on rsync, is running. I have managed to do that with flock. The quetion is that: When the Rsync starts, i want to send an email with all the names of the files that will be backup. If the connection lost during disconnections, i need to mail me which files has been transferred with success and not .If the rsync finished with success , then send an email that all the listed files have been sent with success. If the rsync has nothing to sent, don't sent an email.
Script:
Code:
rsync -av --append --partial --bwlimit=64 --progress -e "ssh -p 22" root@19x.xxx.xxx.xxx:/mnt/To_Office/ /mnt/Office_files/
if [ "$?" -eq "0" ]
then
ssh -p 22 root@19x.xxx.xxx.xxx "rm -f /mnt/To_Office/*"
else
echo "Error while transferring data "
fi
Crontab:
Code:
15 * * * * /usr/bin/flock -n /root/scripts/To_Office.lck sh /root/scripts/To_Office.sh
Any help is much appreciated. Many thanks..