I have been asked to figure out a way to get some of our maintenance programs to run via CRON. The ones that I am having issues with have hcidbinit -ACf in them. The error that I get when I try and get the KSH script to run in the background is:
04/05/2007 12:18:16 [dbi :dbi :ERR /0:training_ib_cmd] Unable to find IDENT database record
04/05/2007 12:18:16 [cmd :cmd :ERR /0:training_ib_cmd] Initialization of DBI failed
04/05/2007 12:18:16 [prod:prod:ERR /0:training_ib_cmd] Unable to initialize the Command Thread.
Of course when I run it from the command line everything works just fine. This is what my script looks like:
#!/usr/bin/ksh
/home/hci/.profile
user=$(whoami)
echo "user == $user"
if [ $user != "hci" ]
then
echo "You must be user hci to run this script."
exit
fi
typeset -i recnum
typeset -i errnum
typeset -i err
err=0
site=training
if
-z $site then
echo ""
echo " ** Need to supply a site. Can not run without a site"
echo ""
exit
fi
autoload setroot
setroot /qdx/qdx5.3/integrator $site
recnum=$(hcidbdump -r | wc -l)
if
$recnum -gt 8 then
echo ""
echo " ** There is information in the recovery database. Will not run"
echo ""
exit
fi
errnum=$(hcidbdump -e | wc -l)
if
$errnum -gt 8 then
echo ""
echo " ** There is information in the error database. Will not run."
echo ""
exit
fi
for proc in `hciprocstatus|sed 1,2d|cut -d" " -f1`
do
echo "Shutting Down Process - $proc"
hcienginestop -p $proc
sleep 5
done
err=0
recnum=$(hcidbdump -r | wc -l)
if
$recnum -gt 8 then
echo ""
echo " ** There is information in the recovery database. Will not run"
echo ""
err=1
fi
errnum=$(hcidbdump -e | wc -l)
if
$errnum -gt 8 then
echo ""
echo " ** There is information in the error database. Will not run."
echo ""
err=1
fi
echo "err == $err"
if
$err -gt 0 then
echo ""
echo "There were errors encountered will start what has been stopped"
echo ""
for proc in `hciprocstatus|sed 1,2d|cut -d" " -f1`
do
echo ""
echo "Starting Process - $proc"
hcienginerun -p $proc
sleep 30
done
echo ""
echo "Done..... ***** There were ERRORS ******"
exit
fi
echo ""
echo "Stopping Deamons"
hcisitectl -Kf
sleep 10
echo ""
echo "Initing the databases"
hcidbinit -A -C -f
sleep 10
echo ""
echo "Starting the Deamons"
hcisitectl -S
sleep 10
echo ""
for proc in `hciprocstatus|sed 1,2d|cut -d" " -f1`
do
echo "Starting Process - $proc"
hcienginerun -p $proc
sleep 30
done
echo "Done."
exit
Has anyone gotten the hcidbinit command to work from a background job?
Thanks in advance.
Rob