The UNIX and Linux Forums  

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


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
New User/Mail setup question. PLEASE help. Rotting UNIX for Dummies Questions & Answers 3 09-27-2007 03:19 AM
mail question here lostinfaith UNIX for Dummies Questions & Answers 1 05-12-2006 11:42 AM
question on mail server piltrafa UNIX for Dummies Questions & Answers 1 07-26-2005 12:12 PM
Mail question? yxiao UNIX for Dummies Questions & Answers 2 10-15-2002 07:53 AM
MAIL question for HP-Unix O/S dsthompson How do I send email? 3 03-26-2002 07:55 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #8  
Old 01-18-2008
Registered User
 

Join Date: Apr 2006
Posts: 74
well if an error occurs on any of the scp i dont want my file successfull command to run and create a log file. That is what i was trying to say so thought to write an if statement and it only executes if the other 2 if statements pass.
Reply With Quote
Forum Sponsor
  #9  
Old 01-18-2008
Registered User
 

Join Date: May 2007
Posts: 61
see if this what you are looking for

Quote:
Originally Posted by chris1234 View Post
well if an error occurs on any of the scp i dont want my file successfull command to run and create a log file. That is what i was trying to say so thought to write an if statement and it only executes if the other 2 if statements pass.
Lets use a flags scp1 and scp2

scp1=0
scp2=0

LOCAL_LOG_FILE="category_`date +%m%d%Y`.log"
date +"%m/%d/%Y %H:%M:%S" >$LOCAL_LOG_FILE
scp -p /az/web/ezap.abc.com/docs/*.gif saloo:/az/web/vendornet.abc.com/docs/tester/bkup

if [ $? != 0 ]; then
echo "error occurred"
mailx -s "Subject" "abc@abc.com" <<-EOT
scp failed
`date`
EOT

scp1=1
fi


scp -p recon:/az/web/vendornet.abc.com/docs/tester/mike/priceops/*.txt audi:/az/web/ezap.abc.com/docs

if [ $? != 0 ]; then
echo "error occurred"
mailx -s "Subject" "abc@abc.com" <<-EOT
scp failed
`date`
EOT

scp2=1

fi

if [ scp1 = 0 ]; then
echo "First SCP successful" >> $LOCAL_LOG_FILE
fi

if [ scp2 = 0 ]; then
echo "Second SCP successful" >> $LOCAL_LOG_FILE
fi
Reply With Quote
  #10  
Old 01-20-2008
Registered User
 

Join Date: Apr 2006
Posts: 74
Thanks alot rakesh.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 05:07 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0