📄 kgbconfig.sh
字号:
#!/bin/ksh# Licensed Materials - Property of IBM# Restricted Materials of IBM## Copyright IBM Corp. 2006 All Rights Reserved.# US Government Users Restricted Rights - Use, duplication or# disclosure restricted by GSA ADP Schedule Contract with# IBM Corp.## Release Name: omdomino_dev## Description: Post configuration script## Parameters:# - CANDLEHOME, set in the environment# - cfg files setup by instance config# - parameter 1: instance name or config file name from callpoint# - optional parameter 2: flag set by callpoint## Returns:# Creates softlinks to kgbclient in the Domino directories#============================================================## make sure running as superuserif id | grep "^uid=0(" >/dev/null 2>&1; then # ask for the ITM 6.1 install directory if not in the environment if [ -z "$CANDLEHOME" -a -z "$2" ]; then while true do echo "Enter the name of the IBM Tivoli Monitoring directory or q to quit:" read CANDLEHOME if [ "${CANDLEHOME}" = "q" ]; then exit 100 fi if [ -f $CANDLEHOME/bin/dynarch.shl ]; then export CANDLEHOME break else echo "ERROR: $CANDLEHOME/bin/dynarch.shl was not found..." fi done fi # setup path to the machine architecture if [ -z "$INST_COMP_COMPONENT_INFO_COMP_ARCH" ]; then # source dynarch.shl in a subshell so it does not modify the environment binArch=`( . $CANDLEHOME/bin/dynarch.shl $CANDLEHOME/registry/archdsc.tbl; setBinLibArchs $cArch gb; echo $binArch )` else binArch=$INST_COMP_COMPONENT_INFO_COMP_ARCH fi # parse the instance cfg files for the notes.ini path # first parameter can be the instance, if null then do all instances if [ -n "$1" ]; then CFGFILES=`ls $CANDLEHOME/config/*_gb_${1}.cfg 2>/dev/null` else CFGFILES=`ls $CANDLEHOME/config/*_gb_*.cfg 2>/dev/null` fi if [ -z "$CFGFILES" ]; then if [ "$2" = "callpoint" ]; then echo "INST_COMP_PLUGIN_START:" echo "INST_COMP_PLUGIN_KEY: No instance(s) found for the Domino agent..." echo "INST_COMP_PLUGIN_KEY: Run $CANDLEHOME/bin/itmcmd config -A gb" echo "INST_COMP_PLUGIN_KEY: to configure an instance, exiting..." echo "INST_COMP_PLUGIN_END:" else echo "ERROR: No instance(s) found for the Domino agent..." echo "ERROR: Run $CANDLEHOME/bin/itmcmd config -A -o <instance> gb" echo "ERROR: to configure an instance, exiting..." fi exit 100 fi for CFG in $CFGFILES do echo # get the instance LINE=`cat $CFG | grep INSTANCE` LINE=${LINE##*INSTANCE=} INSTANCE=${LINE%% *} INSTANCE=`echo $INSTANCE` # get the server LINE=`cat $CFG | grep KGB_SERVER` LINE=${LINE##*KGB_SERVER=} SERVER=${LINE%% *} SERVER=`echo $SERVER` # get the notes.ini path from the cfg file LINE=`cat $CFG | grep KGB_NOTESINIPATH` LINE=${LINE##*KGB_NOTESINIPATH=} NOTESINIPATH=${LINE%% *} NOTESINIPATH=`echo $NOTESINIPATH` NOTESINIPATH=`echo $NOTESINIPATH | sed -e "s/notes.ini//g"` # get and validate the IW port LINE=`cat $CFG | grep KGB_IWPORT` LINE=${LINE##*KGB_IWPORT=} KGB_IWPORT=${LINE%% *} KGB_IWPORT=`echo $KGB_IWPORT` if [ -n "$KGB_IWPORT" -a "$KGB_IWPORT" != "none" ]; then expr "$KGB_IWPORT" + 1 >/dev/null 2>&1 if [ $? -ge 2 ]; then if [ "$2" = "callpoint" ]; then echo "INST_COMP_PLUGIN_START:" echo "INST_COMP_PLUGIN_KEY: Invalid numeric local port value($KGB_IWPORT), exiting..." echo "INST_COMP_PLUGIN_END:" else echo "ERROR: Invalid numeric local port value($KGB_IWPORT), exiting..." fi exit 100 fi fi if [ "$2" = "callpoint" ]; then echo "INST_COMP_PLUGIN_START:" echo "INST_COMP_PLUGIN_KEY: ====>Configuring Instance:$INSTANCE for Domino Server:$SERVER"# echo "INST_COMP_PLUGIN_END:" else echo "INFO: ====>Configuring Instance:$INSTANCE for Domino Server:$SERVER" fi if [ ! -f ${NOTESINIPATH}/notes.ini ]; then if [ "$2" = "callpoint" ]; then echo "INST_COMP_PLUGIN_START:" echo "INST_COMP_PLUGIN_KEY: For Instance:$INSTANCE the ${NOTESINIPATH}/notes.ini file was not found using this directory path..." echo "INST_COMP_PLUGIN_END:" exit 100 else echo "ERROR: For Instance:$INSTANCE the ${NOTESINIPATH}/notes.ini file was not found using this directory path..." fi BAD_NOTESINIPATH=$NOTESINIPATH # ask for the path to the notes.ini file while true do echo "Enter the path to the notes.ini file for Instance:$INSTANCE or q to quit:" read NOTESINIPATH if [ "${NOTESINIPATH}" = "q" ]; then break fi if [ -f ${NOTESINIPATH}/notes.ini ]; then break else echo "ERROR: ${NOTESINIPATH}/notes.ini file was not found using this directory path..." fi done if [ "${NOTESINIPATH}" = "q" ]; then continue fi # fix the cfg file for the correct path cat $CFG | sed -e "s%KGB_NOTESINIPATH=${BAD_NOTESINIPATH}%KGB_NOTESINIPATH=${NOTESINIPATH}%g" > $CFG.tmp mv $CFG.tmp $CFG echo "INFO: Instance:$INSTANCE modified with new notes.ini path:$NOTESINIPATH" fi # determine the Lotus Domino base directory # setup environement based on architecture if [[ "$binArch" = aix+([0-9]) ]] then Notes_ExecDirectory=$LOTUSBASEDIR/notes/latest/ibmpow fi if [[ "$binArch" = sol+([0-9]) ]] then Notes_ExecDirectory=$LOTUSBASEDIR/notes/latest/sunspa fi if [[ "$binArch" = li+([0-9]) ]] then Notes_ExecDirectory=$LOTUSBASEDIR/notes/latest/linux fi if [[ "$binArch" = ls+([0-9]) ]] then Notes_ExecDirectory=$LOTUSBASEDIR/notes/latest/zlinux fi # determine the Lotus Domino user id LOTUSOWNER=`ls -l ${NOTESINIPATH}/notes.ini | awk '{print $3}'` if [ -z "$LOTUSOWNER" ]; then if [ "$2" = "callpoint" ]; then echo "INST_COMP_PLUGIN_START:" echo "INST_COMP_PLUGIN_KEY: Lotus user id was not found, skipping..." echo "INST_COMP_PLUGIN_END:" exit 100 else echo "ERROR: Lotus user id was not found, skipping..." fi continue fi id $LOTUSOWNER >/dev/null 2>&1 if [ $? -ne 0 ] ; then if [ "$2" = "callpoint" ]; then echo "INST_COMP_PLUGIN_START:" echo "INST_COMP_PLUGIN_KEY: Lotus user id($LOTUSOWNER) was not valid, skipping..." echo "INST_COMP_PLUGIN_END:" exit 100 else echo "ERROR: Lotus user id($LOTUSOWNER) was not valid, skipping..." fi continue fi # determine the Lotus Domino group id LOTUSGROUP=`ls -l ${NOTESINIPATH}/notes.ini | awk '{print $4}'` if [ -z "$LOTUSGROUP" ]; then if [ "$2" = "callpoint" ]; then echo "INST_COMP_PLUGIN_START:" echo "INST_COMP_PLUGIN_KEY: Lotus group id was not found, skipping..." echo "INST_COMP_PLUGIN_END:" exit 100 else echo "ERROR: Lotus group id was not found, skipping..." fi continue fi # do the necessary owner/grp modifications and softlinks if [ -f ${LOTUSBASEDIR}/bin/kgbclient ]; then cd $LOTUSBASEDIR/bin rm -f kgbclient fi cd $Notes_ExecDirectory rm -f kgbclient cd $CANDLEHOME/$binArch/gb/bin chown $LOTUSOWNER $CANDLEHOME/$binArch/gb/bin/kgbclient chgrp $LOTUSGROUP $CANDLEHOME/$binArch/gb/bin/kgbclient chmod 2555 $CANDLEHOME/$binArch/gb/bin/kgbclient ln -fs $CANDLEHOME/$binArch/gb/bin/kgbclient $Notes_ExecDirectory/kgbclient ln -fs $LOTUSBASEDIR/bin/tools/startup $LOTUSBASEDIR/bin/kgbclient if [ $? -ne 0 ]; then if [ "$2" = "callpoint" ]; then echo "INST_COMP_PLUGIN_START:" echo "INST_COMP_PLUGIN_KEY: kgbclient executable softlink failed, skipping..." echo "INST_COMP_PLUGIN_END:" exit 100 else echo "ERROR: kgbclient executable softlink failed, skipping..." fi break else if [ "$2" = "callpoint" ]; then echo "INST_COMP_PLUGIN_START:" echo "INST_COMP_PLUGIN_KEY: $CANDLEHOME/$binArch/gb/bin/kgbclient linked to $Notes_ExecDirectory/kgbclient" echo "INST_COMP_PLUGIN_KEY: $LOTUSBASEDIR/bin/tools/startup linked to $LOTUSBASEDIR/bin/kgbclient" echo "INST_COMP_PLUGIN_END:" else echo "INFO: $CANDLEHOME/$binArch/gb/bin/kgbclient linked to $Notes_ExecDirectory/kgbclient" echo "INFO: $LOTUSBASEDIR/bin/tools/startup linked to $LOTUSBASEDIR/bin/kgbclient" fi fi doneelse if [ "$2" = "callpoint" ]; then echo "INST_COMP_PLUGIN_START:" echo "INST_COMP_PLUGIN_KEY: This script must be run as the superuser, exiting.." echo "INST_COMP_PLUGIN_END:" else echo "ERROR: This script must be run as the superuser, exiting.." fi exit 100fiexit 0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -