#!/bin/ksh # IBM_PROLOG_BEGIN_TAG # This is an automatically generated prolog. # # bos720 src/bos/etc/rc.d/rc.sh 1.4 # # Licensed Materials - Property of IBM # # Restricted Materials of IBM # # COPYRIGHT International Business Machines Corp. 2000,2007 # 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=$(/usr/bin/ls /etc/rc.d/rc${run_level}.d | /usr/bin/grep "^K" | /usr/bin/sort -) #get a list of the "start" scripts in this directory s_list=$(/usr/bin/ls /etc/rc.d/rc${run_level}.d | /usr/bin/grep "^S" | /usr/bin/sort -) #execute "kill" scripts if [[ -n ${k_list} ]] then for item in ${k_list} do /etc/rc.d/rc${run_level}.d/${item} stop done fi #execute "start" scripts if [[ -n ${s_list} ]] then for item in ${s_list} do /etc/rc.d/rc${run_level}.d/${item} start done fi else echo "Requested run level directory does not exist" fi exit 0