Hi, I have a bash script that watch's a directory for uploads. When it sees a xml file in the directory. The script takes the file and calls a java command line program that using xslt transforms the file. I want to mv the file to a different directory (errors) if the script or java command line program throws a error during processing. Then email me the error.
I was going to put exec 2> mail -s 'Statement Error Processing'
at the top of the script to catch output for stderr. But that doesn't seem very elegant and doesn't move the file in question.