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 -->
  #5 (permalink)  
Old 06-01-2009
d.f. d.f. is offline
Registered User
  
 

Join Date: Nov 2006
Posts: 5
If I understand this correctly, you're looking for a way to make sure that the rsync completes successfully before moving on to the rest of your script. bash would allow you to do this with the '&&' operator (in this case rsync is command1 ):

Code:
command1 && command2
From the bash man page, "command2 is executed if, and only if, command1 returns an exit status of zero."

So, something you might be able to use would be :

Code:
rsync -options file.xx remotehost:/path/to/store && rm file.xx
The gotcha here is that rsync can fail for a couple different reasons and if it does, the second command would not execute.