The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM



View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #4 (permalink)  
Old 01-18-2008
rakeshou rakeshou is offline
Registered User
 

Join Date: May 2007
Posts: 61
you are sending success message on error...think it is wrong

Quote:
Originally Posted by chris1234 View Post
Thanks dude. Well even if there is an error in any one of the SCP my log file is still generated. So i thought to add an if statement if the test pass then only log it .

Code:
 if [ $? >= 0]; then
 echo "File Transfer Successful"
 mailx -s "Scp Passed Successful" "suleman.zia@autozone.com" <<-EOT
 All the files havve been transfered successfully
 `date
 EOT
 echo "File copied Successfully `date +%n%m/%d/%Y%n%H:%M:%S`" >>$LOCAL_LOG_FILE
 fi
you are sending success message on error...think it is wrong

if [ $? -ge 0 ]; then

means if there is an error
Reply With Quote