#!/bin/sh PATH=/usr/sbin:$PATH:/sbin:/home/root:/usr/local/bin:$JAVA_HOME servername=ipaddress SID=EPP TAR=EPP-J2EE-FS.tar FILE=EPP-J2EE-FS.tar.gz REPO=/usr/sap/trans/EPS/in J2EE=/usr/sap/$SID LOG=/home/eppadm/scripts/epp-sync-j2ee-daily.log KEY=/home/eppadm/.ssh/eppadm_rsa USER=gssdp DEST=$servername # Tar the filesystem $J2EE to the file, create if not exist, else update # Create the tar file using dummy file, select 'changed' file(s) for past 1 day, add to tar file echo " Waiting until tar is complete ..." touch readme $REPO/readme.txt tar -cvf $REPO/$TAR $REPO/readme.txt find $J2EE -type f -mtime -1| xargs tar -rvf $REPO/$TAR find $J2EE -type l -mtime -1| xargs tar -rvf $REPO/$TAR echo " Tar completed successfully " echo " Waiting until gzip is complete ..." gzip -c -9 $REPO/$TAR > $REPO/$FILE echo " Gzip completed successfully " rm $REPO/$TAR # Once done, SCP to the DR system su - $USER -c "scp -i $KEY $REPO/$FILE $USER@$DEST:$REPO" echo "File EPP-J2EE-FS.tar.gz transferred on `date`" >> $LOG # Delete the created file; else next job will fail rm -rf $REPO/$FILE