#!/usr/bin/ksh93 # IBM_PROLOG_BEGIN_TAG # This is an automatically generated prolog. # # 61haes_r714 src/43haes/usr/sbin/cluster/sa/dhcp/sbin/cl_dhcp_start.sh 1.1 # # Licensed Materials - Property of IBM # # COPYRIGHT International Business Machines Corp. 2010 # 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 # @(#)25 1.1 src/43haes/usr/sbin/cluster/sa/dhcp/sbin/cl_dhcp_start.sh, hacmp, 61haes_r714 11/28/11 15:22:53 ############################################################################### # # Name: cl_dhcp_start # # Description: start script to start DHCP daemon (dhcpsd) # # Syntax: cl_dhcp_start # # Returns: 0 on SUCCESS # 1 on FAILURE # ############################################################################### ############################################################################### # # Name: isRunning # # Description: Check to see if DHCP daemon (dhcpsd) is active. # # Arguments: none # # Returns: 0 on RUNNING # 1 on NOT RUNNING # ################################################################################ function isRunning { [[ "$VERBOSE_LOGGING" == "high" ]] && set -x # : DHCP daemon - dhcpsd is active or not # KLIB_SA_logmsg INFO 3 1 dhcpsa.cat "Verifying to see DHCP server daemon dhcpsd is active." LC_ALL=C /usr/bin/lssrc -s dhcpsd | /usr/bin/grep -iw active >> $LOG_FILE 2>&1 if (( $? == 0 )); then KLIB_SA_logmsg INFO 3 2 dhcpsa.cat "DHCP server daemon dhcpsd is active" return 0 else KLIB_SA_logmsg INFO 3 3 dhcpsa.cat "DHCP server daemon dhcpsd is not active" return 1 fi } ############################################################################### # # Name: doStart # # Description: Start the DHCP server # # Arguments: none # # Returns: 0 on SUCCESS # 1 on FAILURE # ################################################################################ function doStart { [[ "$VERBOSE_LOGGING" == "high" ]] && set -x # : Starting the DHCP server dhcpsd daemon # /usr/bin/startsrc -s dhcpsd >> $LOG_FILE 2>&1 # : Check the status DHCP server dhcpsd daemon # isRunning (( $? == 0 )) && { KLIB_SA_logmsg INFO 3 4 dhcpsa.cat "DHCP server daemon dhcpsd started" return 0 } KLIB_SA_logmsg ERROR 3 5 dhcpsa.cat "DHCP server daemon dhcpsd unable to start" return 1 } ############################################################################### # Main program procedure. ############################################################################### PROGNAME=$(basename ${0}) PATH="$($(dirname ${0})/../../../utilities/cl_get_path all)" PATH=$PATH:/usr/bin:/etc:/usr/sbin:/usr/ucb:/sbin FPATH_BASE=/usr/es/lib/ksh93 FPATH=$FPATH_BASE/hacmp:$FPATH_BASE/sa:$FPATH_BASE/db2:$FPATH_BASE/aix:$FPATH_BASE/aix/odm export PATH FPATH # : Load the common variables # . /usr/es/sbin/cluster/sa/dhcp/sbin/cl_dhcp_common_variables LOG_FILE=$(clodmget -q name=$KLIB_HACMPLOG_ENTRY -f value -d "=" HACMPlogs) LOG_FILE=${LOG_FILE//\"/} LOG_FILE="$LOG_FILE/$KLIB_HACMPLOG_ENTRY" [[ "$VERBOSE_LOGGING" == "high" ]] && set -x DEBUG=${DEBUG:-"0"} VERBOSE=${VERBOSE:-"0"} echo "######################################################" >> $LOG_FILE dspmsg -s 3 dhcpsa.cat 6 "# DHCP START LOG" >> $LOG_FILE echo "######################################################" >> $LOG_FILE # : Find out to see DHCP server dhcpsd daemon is active # isRunning (( $? == 1 )) && { KLIB_SA_logmsg INFO 3 7 dhcpsa.cat "Starting DHCP server daemon dhcpsd" # : DHCP server dhcpsd daemon is not active. : Make an attempt to start. # doStart exit $? } exit 0