I am having a parent scripts which reads a file with child scripts name.
I need to read one by one child script , execute it and
- If child script fails send mail to the team with the log file
- If the child script executes fine then proceed with the next child script execution.
#! /bin/ksh
set -x
#**************************************************************************#
# Program Name : test.ksh
#***************************************************************************#
while read line
do
. /child1.ksh
returnstatus=$?
if [ returnstatus -ne 0 ]
then
<mail the team>
if [ $? -ne 0 ]
then
echo "Error while sending the mail"
exit 255
else
echo "Mail sent successfully"
fi
else
echo "$line ran successfully"
<run the next child script>
fi
done <"$file"
exit 0
The file will be like
child1
child2
child3
child4
child5