Chapter 2. DB2 server deployment 85
f) FOPT="$FOPT""-f $OPTARG " ;; # force options can be combined
l) LOGFILE=$OPTARG ;;
t) TRC=$OPTARG ;;
\?) syntax && exit 1;;
esac
done ;;
esac
# set variables
BASEHOST=`hostname`
LOCALNFS="/db2nfs.$$"
BMSG1=" Starting fixpack deployment on machine %s using %s...\n"
BMSG2=" Messages returned from %s:\n ---------------\n"
EMSG1=" ---------------\n Fixpack deployment finished on machine %s.\n"
# go through the host list
for host in $HOSTLIST
do
# populate command and do basic testing to ensure ssh can work.
RCMD="ssh $host"
${RCMD} hostname 2> /dev/null|egrep -i '^'"$host"'$' > /dev/null 2>&1
rc=$?
if [ $rc != 0 ]; then
# if ssh fails, target host is ignored.
echo " ============================
Error:
Machine $host could not be connected successfully. Please check.
It will be ignored in this deployment.
"
else
# mount NFS
mountnfs
rc=$?
if [ $rc != 0 ]; then
continue
fi
# Deploy fixpack onto machine $host
echo " ============================"
printf "$BMSG1" $host "$MSG"
printf "$BMSG2" $host
db2fp_dply
printf "$EMSG1" $host
# unmount NFS & remove temporary mount point
umountnfs
${RCMD} rmdir $LOCALNFS