Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Check if file loaded to another box

Status
Not open for further replies.

Tim2525

Technical User
Joined
Feb 7, 2005
Messages
51
Location
US
Hi All,

Here is another simple qs. I am using rsync to tranfers a backup file to another Solaris 8 box. How would I check to see if the file transfered successfully.


##SSH the file.
rsync -a -e ssh /export/home/db2inst1/backupCampmor sample@anotherbox: /db2_backup

if [ <file transferred successfully> ]
then
echo "CAMPMOR DATABASE BACKUP FAILED" >> /db2_backup/timer.txt
print "CAMPMOR DATABASE BACK UP FAILED"
exit 1
fi


TIA,

T
 
The rsync command should return an error code, so this should work:

Code:
if rsync -a -e ssh /export/home/db2inst1/backupCampmor sample@anotherbox: /db2_backup
then
   echo "CAMPMOR DATABASE BACKUP FAILED" >> /db2_backup/timer.txt
   print "CAMPMOR DATABASE BACK UP FAILED"
   exit 1
fi


Annihilannic.
 
Sorry, sorry...

Code:
if ! rsync -a -e ssh /export/home/db2inst1/backupCampmor sample@anotherbox: /db2_backup
then
   echo "CAMPMOR DATABASE BACKUP FAILED" >> /db2_backup/timer.txt
   print "CAMPMOR DATABASE BACK UP FAILED"
   exit 1
fi

I got the sense of the if statement the wrong way around. :-)

Annihilannic.


Annihilannic.
 
Thanks much Annihilannic.

T
 
Thanks again Annihilannic..

T
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top