ADSM-L

Re: AIX Client automatic start for dsmcad

2003-02-27 16:07:52
Subject: Re: AIX Client automatic start for dsmcad
From: Allen Barth <allen.barth AT DB DOT COM>
To: ADSM-L AT VM.MARIST DOT EDU
Date: Thu, 27 Feb 2003 15:05:02 -0600
I'm at AIX 4.3.3 ML 10

Somewhere along ML 6 or so, additional entries were added to /etc/inittab
such that an rc script gets executed and passed the run-level much like in
Solaris and other unix environments.

Example:
l2:2:wait:/etc/rc.d/rc 2
l3:3:wait:/etc/rc.d/rc 3
l4:4:wait:/etc/rc.d/rc 4
l5:5:wait:/etc/rc.d/rc 5
l6:6:wait:/etc/rc.d/rc 6
l7:7:wait:/etc/rc.d/rc 7
l8:8:wait:/etc/rc.d/rc 8
l9:9:wait:/etc/rc.d/rc 9

The rc script gets a listing of "user defined scripts" residing in each
corresponding rc(runlevel).d directory and executes kill scripts followd
by start scripts by passing a stop or start parameter. These allow for a
much more user controlled run-level to run-level environment switch.

contents of /etc/rc.d/rc script:
#!/bin/ksh
# IBM_PROLOG_BEGIN_TAG
# This is an automatically generated prolog.
#
# bos43V src/bos/etc/rc.d/rc.sh 1.2
#
# Licensed Materials - Property of IBM
#
# Restricted Materials of IBM
#
# (C) COPYRIGHT International Business Machines Corp. 2000,2001
# 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
#############################################################
# file name:    rc
# purpose:      run user-provided scripts in rc directories
#############################################################
#run level parameter
run_level=${1}
#check if valid run level was requested
case "$run_level"
in
        [01] ) echo "Invalid run level choice; levels 0 and 1 are reserved
in AIX "
        ;;
        [a-zA-Z] ) echo "Please enter a run level from 2 to 9"
        ;;
esac

#check if run level directory exists
if [[ -s /etc/rc.d/rc${run_level}.d ]] then
        #get a list of the "kill" scripts in this directory
        k_list=$(ls /etc/rc.d/rc${run_level}.d | grep "^K" | sort -)

        #get a list of the "start" scripts in this directory
        s_list=$(ls /etc/rc.d/rc${run_level}.d | grep "^S" | sort -)

        #execute "kill" scripts
        if [[ -n ${k_list} ]] then
                echo "${k_list}" | while read item
                do
                        /etc/rc.d/rc${run_level}.d/${item} stop
                done
        fi

        #execute "start" scripts
        if [[ -n ${s_list} ]] then
                echo "${s_list}" | while read item
                do
                        /etc/rc.d/rc${run_level}.d/${item} start
                done
        fi
else
        echo "Requested run level directory does not exist"
fi
exit 0

The normal AIX run-level is 2, so in /etc/rc.d/rc2.d I have:
lrwxrwxrwx   1 root     system        16 Nov 13 13:46 S81tsmcad ->
/etc/rc.d/tsmcad
in other runlevels, you put (or should put): K81tsmcad -> /etc/rc.d/tsmcad

/etc/rc.d/tsmcad contents are:
case "$1" in
'start')
        nohup /usr/tivoli/tsm/client/ba/bin/dsmcad & # TSM web client
acceptor
        ;;
'stop')
        kill -9 `ps -ef|grep dsmcad|grep -v grep|awk ' {print $2} '`
        ;;
esac

At anytime I can start or stop dsmcad manually;
To start: /etc/rc.d/rc2.d/S81tsmcad start
To stop: /etc/rc.d/rc2.d/S81tsmcad stop

WORKS GREAT!

Regards,
Al Barth





David Longo <David.Longo AT HEALTH-FIRST DOT ORG>
Sent by: "ADSM: Dist Stor Manager" <ADSM-L AT VM.MARIST DOT EDU>
02/26/03 12:14 PM
Please respond to "ADSM: Dist Stor Manager"


        To:     ADSM-L AT VM.MARIST DOT EDU
        cc:
        Subject:        Re: AIX Client automatic start for dsmcad

<SNIPPED TO END>

<Prev in Thread] Current Thread [Next in Thread>