HI all,
I am very new to AIX (matter of fact Unix). We are currently automating out manual process using Unix Shell Scripting.
My wrote a shell script which will accept the name of the sas job as parameter, checks the existense of the sas file in the specified folder.
If it is not present, the shell script will exit with 1, otherwise it will continue to execute the sas code. If the sas code fails, the script will check the return code
if [ $? -ne 0 ]; then mailx -s "job failed"
xxxxx@xx.com
else mailx -s "Job Complete"
xxxxx@xx.com
The problem we found is that, if I kill the shell script forcibly, then there is no warning or message of any kind. I would like to handle such a situation by triggering an email. How can i capture the return code for such a thing and use it to email saying the user terminated the Script or sas job?
Any suggestions!!!!!!