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 wOOdy-Soft 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
Feb 7, 2005
51
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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top