Thursday, August 23, 2018

ITNM Startup Script - multiple domains

#!/bin/sh
###############################################################################
#
# chkconfig: 35 92 98
# description: Automatic startup/shutdown script for
# Netcool/Precision for IP Networks
#
### BEGIN INIT INFO
# Provides: ncp
# Required-Start: $network $sshd
# Required-Stop: $network $sshd
# X-UnitedLinux-Should-Start: portmap autofs
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Description: Start the ncp daemon
### END INIT INFO

# File ID:     itnm/src/process/templates/ncp_auto.sh, itnm, itnm1.1
# Version:     1.2
# Last Update: 4/20/07 14:00:21
#
# IBM Confidential
# Licensed Materials - Property of IBM
# (c) Copyright IBM Corp. 2007 All Rights Reserved.
#
###############################################################################
#
# To install this in the /etc directory, run ncp_create_control_scripts.sh
# from the installation directory as root.
#
# Usage: ncp start | stop
# Exit status: 0=success, 1=warning, 2=failure
#
###############################################################################
##  All comments here

ITNMUSER=netcool
#DOMAINLIST="NCPRD_P"
DOMAINLIST="RETAIL2_P RETAIL1_B"

# These variables are set by 'sed' in the creation script.
set_edited_vars () {
    NCHOME=/opt/ibm/tivoli/netcool
    ITNM_BIN_DIR=/opt/ibm/tivoli/netcool/precision/bin
    ITNM_CONTROL_FUNCS=/opt/ibm/tivoli/netcool/precision/bin/itnm_control_functions.sh
    ITNM_AUTO_LOG_FILE=/opt/ibm/tivoli/netcool/log/precision/boot.log
    export ITNM_AUTO_LOG_FILE
}

#########################################################################
#
#  MAIN
#
#########################################################################

set_edited_vars
. $ITNM_CONTROL_FUNCS
check_exec_exists ${ITNM_BIN_DIR}/ncp_control.sh

# Tell subordinate script that this is called from the /etc/init directory
AUTO_INIT=YES
export AUTO_INIT

if `grep "^admin=" $NCHOME/etc/itnm.cfg 1>/dev/null 2>&1`; then
   user=`grep "^admin=" $NCHOME/etc/itnm.cfg 2>/dev/null | cut -f2 -d=`
else
   user=`grep "^installer=" $NCHOME/etc/itnm.cfg 2>/dev/null | cut -f2 -d=`
fi

case "$1" in
start|stop)
        for DOMAIN in $DOMAINLIST
        do
                #echo "Starting Domain Name ....  " $DOMAIN
                su - $user -c "${ITNM_BIN_DIR}/ncp_control.sh -domain $DOMAIN $1"
        done
;;
restart|reload)
        $0 stop
        $0 start
        ;;
*)
    echo "Usage: $0 {start|stop|restart|status}"
    exit 1
    ;;
esac

exit $?

No comments:

Post a Comment