A long time ago I learned setsite was not as clean as I would like and discover some left over baggae when using it.
I’m not sure if that is true anymore but I went to using setroot from KSH scripts to change sites and avoid using setsite.
Here is an example KSH script I located to illustrate how I use setroot that has worked better for me than setsite probably becuase the “setroot clear” gets me to a clean slate first before doing the second setroot that sets the HCIROOT and HCISITE.
#!/usr/bin/ksh
# Begin Module Header ==========================================================
#
#
#——
# Name:
#——
#
# mk_stop_start_scripts_for_all_sites.ksh
#
#———
# Purpose:
#———
#
# dynamically create all the
#
# $HCISITEDIR/scripts/site_shutdown.ksh
# $HCISITEDIR/scripts/site_startup.ksh
#
# scripts for every clvoerleaf site for the current $HCIROOT
#
#——-
# Notes:
#——-
#
# before calling this script be sure the $HCIROOT is set appropriately
#
# after this script is completed you will need to run the scripts that got created
# by invoking them manually one at a time or by running all of the by doing one of the following:
#
# mda_cloverleaf_IPL.ksh shutdown
# mda_cloverleaf_IPL.ksh start
#
#
#———
# History:
#———
#
# 2002.11.07 Russ Ross
# – wrote initial version.
#
# 2003.02.28 Russ Ross
# – modified the stop_directory and start_directory to include the cloverleaf version #
#
# 2002.03.14 Russ Ross
# – removed the stop_directory and start_directory variables
# becuase redisgned to use the $HCISITEDIR/scripts
#
# 2003.03.21 Russ Ross
# – added hci_root variable because setroot -clear gets rid of $HCIROOT
#
# 2006.03.06 Russ Ross
# – backgrounded mk_stop_start_scripts_for_current_site.tcl to speed
# up how long it takes to create all the stop/start scripts for all sites
# (used to be on mdahub1 and mdahub4 we had to do this one site at a time
# because those system were not powerful engough to do all the sites at once)
# – commented out the chmod and chown steps because they will not work
# as a result of the backgournding; so these steps have to be done by the
# mk_stop_start_scripts_for_current_site.tcl script
# – added wait command at the end to make sure all backgrounded process have finished
#
# End Module Header ============================================================
saveDir=`pwd`
hci_root=$HCIROOT
for site in `list_sites.ksh`; do
setroot -clear
setroot $hci_root $site
echo ” ”
echo “——————————-”
echo “creating stop/start scripts for $HCIROOT/$site”
echo “——————————-”
echo ” ”
if [[ ! -d $HCISITEDIR/scripts ]]; then
mkdir $HCISITEDIR/scripts
fi
mk_stop_start_scripts_for_current_site.tcl &
done
cd $saveDir
#————————————————————-
# make sure all the processes this script called have finished
#————————————————————-
wait
I also don’t run setsite from the command prompt but created a function that for Cloverleaf 6.0 I called set60 that passes the site name to the .profile login process and sources the .profile similar to what another poster mentioned above.
So from the command propmt for example to change sites I type something like
set60 test_russ ; # where test_russ is the site I want to change to
Here is my set60 function that I use when I want to change sites from one of my interactive xterm command prompts under AIX:
function set60
{
export ROOT=”/cloverleaf/cis6.0/integrator”
export SITE=$1
currentDir=`pwd`
cd $HOME
. ~/.profile
cd $currentDir
}
If you drive yourself crazy looking for setroot it is also a function and was a learning experience discovering this and the motivator for me to utilize creating a function for my set60.
To see all the defined functions type
functions
at the AIX command prompt and you will also see the setroot function defined as follows in Cloverleaf 6.0:
function setroot
{
eval `${CL_INSTALL_DIR}/integrator/sbin/hcisetenv -root ksh $*`
}
Russ Ross
RussRoss318@gmail.com