you can use this ,I didnt know how your network is setup and where the backup server is, but since your rsyning I know you have at least key authentication, so it should be simple.Just use this script below.It will rsync your data as you always do, and present you with a log of what was done.It will then tell you whether or not both directories are the same in an email.
#!/bin/bash
PATH=/var/www
BACKUP=root@123.1.20.5:/usr/src
LOCALFOLDER=/var/www
COMMAND=$(rsync -options $PATH $BACKUP > ssh_log.txt.$(date + %F))
#WONT WORK
Quote:
SSH=$(ssh $BACKUP)
CHECK=$(diff $PATH $SSH)
|
#instead do the following
REMOTEFOLDER=$(ssh root@111.111.111.1 'ls -lA /var/www'| grep -E '^total' | cut -d " " -f 2 > remotessh.txt)
COMMAND=$(ls -lA $LOCALFOLDER | grep -E '^total' | cut -d " " -f 2 > localssh.txt)
REM=$(cat remotessh.txt)
LOCAL=$(cat localssh.txt)
#Or you can choose to diff the two files here.
if [ $REM -eq $LOCAL ]
then
echo Directories are the same
echo ssh_log.txt.$(date + %F) | mail -s "SSH LOGS"
else
echo Directories are differnt
fi