Notify via email if something wrong got happened in the shell script
        Posted  
        
            by 
                Nevzz03
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Nevzz03
        
        
        
        Published on 2012-09-07T21:03:23Z
        Indexed on 
            2012/09/07
            21:38 UTC
        
        
        Read the original article
        Hit count: 231
        
fileexist=0
for i in $( ls /data/read-only/clv/daily/Finished-HADOOP_EXPORT_&processDate#.done); do
  mv /data/read-only/clv/daily/Finished-HADOOP_EXPORT_&processDate#.done /data/read-only/clv/daily/archieve-wip/
  fileexist=1
done
--some other script below
Above is the shell script I have in which in the for loop, I am moving some files. I want to notify myself via email if something wrong got happened in the moving process, as I am running this script on the Hadoop Cluster, so it might be possible that cluster went down while this was running etc etc. So how can I have better error handling mechanism in this shell script? Any thoughts?
© Stack Overflow or respective owner