Saturday, 29 May 2021

Sync file system from one server to another using rsync command

#Create a script file with below contents. 
#Before running the script, implement ssh between source and destination server

# replace user and ip with correct value

src1=/a02/fmwprod/
src2=/etc/oraInventory/
des1=/a02/fmwprod/
des2=/etc/oraInventory/
user=xxxxx
ip=xx.xx.xx.xx


echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"

echo "Starting to execute the 'rsync' utility...."


/usr/bin/rsync -av $src1 $user@$ip:$des1
/usr/bin/rsync -av $src2 $user@$ip:$des2

echo "The execution has ended. Please check log created in tmp directory"

echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"

 #Schedule using crontab 

25 14 * * *  sh /home/rsyncFMW.sh 2>/tmp/rsync_sourceTOdest.err 1>/tmp/rsync_sourceTOdest.log


No comments:

Post a Comment