The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #3 (permalink)  
Old 05-26-2009
jaysunn's Avatar
jaysunn jaysunn is offline
Registered User
  
 

Join Date: May 2009
Posts: 22
I like to use a lock file. This way the script will loop till lock file is gone than re execute:
Code:
#
# create name for lock file
#
lockDir="/root/lock_files"
lockFilePath="$lockDir/file.lock"
#
#
#
# Loop through servers until file is no longer exists
#  
while [ -e "$lockFilePath" ]
do

   exit
done
#
#
#
# create new lock file
#
touch $lockFilePath
#
#
#
# loop through servers and sync docroots and code
#
/usr/bin/rsync  --stats -e ssh -rlvtgoDz --delete  /dir/dir/dir/ root@server:/dir/dir/dir/ &
#
#
#
# Remove lock file........
#
rm -f $lockFilePath

Be sure to set up ssh keys. This is run on a Red Hat system.

Good Luck