#!/bin/sh # IBM_PROLOG_BEGIN_TAG # This is an automatically generated prolog. # # bos720 src/bos/usr/lpp/bosinst/samples/AE/AE/RemoveService.sh 1.1 # # Licensed Materials - Property of IBM # # COPYRIGHT International Business Machines Corp. 2008,2009 # All Rights Reserved # # US Government Users Restricted Rights - Use, duplication or # disclosure restricted by GSA ADP Schedule Contract with IBM Corp. # # IBM_PROLOG_END_TAG # @(#)27 1.1 src/bos/usr/lpp/bosinst/samples/AE/AE/RemoveService.sh, bosinst, bos720 3/29/09 15:20:00 # RemoveService - a utility for removing services added by AE scripts. AL=`find /opt/IBM/AE/AL/ -name "*.al"` TEMPCONF="/tmp/tempconf" PERL_BIN="/usr/bin/perl" AEPATH="/opt/IBM/AE" START_SCRIPT_PATH="/etc/rc.d" ECHOE="echo -e" UNAME=`uname -s`; if [ "$UNAME" = "AIX" ] then # /etc/rc.d is a symlink to /etc/init.d on suse # /etc/init.d does not exist on aix, but /etc/rc.d/init.d does # scripts usually kept in init.d instead of rc.d for aix START_SCRIPT_PATH="$START_SCRIPT_PATH/init.d" ECHOE="echo" fi MANAGEAL_BIN="${AEPATH}/AE/ManageALFile" #---------------functions-----------------# # extract configuration element extractConfFromAL() { cat $AL> $TEMPCONF } # extract service names extractServName() { $ECHOE "$1" | sed "s/.*service name=\"//g" | sed "s/\".*//g" } function hasDependency() { servName=$1 lineNum=`grep -n "${servName}" ${AL}|awk -F : '{print $1}'` while : do line=`sed -n "${lineNum}p" ${AL}` if [ -z "$line" ] then break else case ${line} in *dependency*) containDeps=1 break ;; *configuration*) break ;; *) ;; esac fi lineNum=$[ $lineNum + 1 ] done echo -n "$containDeps" } # parse the resource name function extractRsrcName() { line=$1 retValue=`echo ${line}|awk -F \" '{print $2}'` echo "${retValue}" } # parse the configuration name function extractConfName() { line=$1 retValue=`echo ${line}|awk -F \" '{print $2}'` echo "${retValue}" } # delete record in start script file function delStartRecord() { servName=$1 rsrcName=$2 confName=$3 # if [ "$UNAME" = "AIX" ] # then # rmitab ${servName} # else sed -i "s/.*${rsrcName} ${confName}.*//" "${START_SCRIPT_PATH}/${servName}" sed -i "/^$/d" "${START_SCRIPT_PATH}/${servName}" # fi } # parse temp al file and remove services parseTempConf() { while read line do case ${line} in *\