- 论坛徽章:
- 0
|
I finished it, it works.........
#!/bin/ksh
#Function: Run a chain of jobs sequently, when one job is aborded, quit it and send out notification
#By George16Nov. 26th. 2008
#Define the commnad list need to be run.
CMD_LIST=/home/george16/test.list
#Define the email variable
MAIL_L="george16@chinaunix.com"
MAILFILE=/tmp/dependency.log
MAIL_S="Dependency job aborded!!!"
while read cmd
do
$cmd
RC=$?
if [ "$RC" -eq "0" ]
then
echo run $cmd successfully!!!!!!!!!!! return code is $RC
else
echo return code $RC
echo Job $cmd failed!!! Please investigate!!! Reture code is $RC > $MAILFILE
MAIL_S="$Dependency job $cmd ABORDED!!!"
mail -s "${MAIL_S}" ${MAIL_L} < ${MAILFILE}
exit
fi
done < $CMD_LIST
[ 本帖最后由 george16 于 2008-11-28 00:58 编辑 ] |
|