I am not a scripty type person so I could use a little help... I am Using CV v9 SP3 and elected to save a backup as a script. We use CA AutoSys to run the jobs and pass return codes back. Here is my code (most changes are the last 20 or so lines) if anyone can help me figure out what is wrong....If the backup works, I want to pass back a 0, if it fails a 10 and if it is killed via CV an 11. Codes are passed back to AutoSys to notify me thru email. For security reasons, some names have been changed - commcell, process id, etc...
**********************************************script below ************************************
#!/bin/sh
cd /celadm/autosysscripts
flag=0
response="tbak001_inc_13186247.tmp"
GALAXY_BASE=${GALAXY_BASE:-/opt/simpana/Base}
PATH=$PATH:$GALAXY_BASE; export PATH
qlogin -u "process id goes here" -ps "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" -cs "commcell server name goes here"
if [ $? -ne 0 ]
then
echo Login failed.
else
while :
do
if [ "$1" ]
then
input=$input $1
shift
else
break;
fi
done
qoperation execute -af "tbak001_inc_1318624727.xml" >$response
if [ $? -ne 0 ]
then
echo Failed to start Job.
else
cat $response | \
while read line
do
echo $line
done
sleep 120
qlist job -co is -af $response > output_1318624727.result
cat output_1318624727.result | \
while read line
do
echo $line
done
echo Processing...
while :
do
sleep 20
flag=0
qlist job -co is -af $response > output_1318624727.result
while read line
do
for word in $line
do
case $word in
Running*) flag=1; break 2; ;;
Waiting*) flag=1; break 2; ;;
esac
done
done
if [ $flag = 0 ]
then
break;
fi
done < output_1318624727.result
echo FinalJobStatus;
cat output_1318624727.result | tail -1 > JobSummary
case "$JobSummary" in Completed*) echo Job completed successfully.; exit 0; ;;
Failed*) echo Job has failed.; exit 10; ;;
Killed*) echo Job is killed.; exit 11; ;;
*) ;;
esac
qlogout
if [ $? -ne 0 ]
then
echo Logout failed.
fi
