Here is another example of a script that illustrates looping over sites and calling msiAttach.
This script checks for shared memory problems by showing what threads are in the shared memory region for a given site but aren’t defined in the NetConfig for that site.
If you do things like msiAttach when the shared memory doesn’t exist you will get alot of shared memory issues showing up when you run this script to highlight them and bring them to your attention.
Here is the code for check_shmem.ksh
#########################################################################
# This script checks to see if the list of threads in shared memory
# matches what is in the NetConfig
#
#———
# History:
#———
#
# 2004.10.17 Russ Ross
# – modified to call setroot instead of hcisetenv
# – modified to skip sites that do not have a $HCISITEDIR/exec/monitorShmemFile
#
ROOT=”$HCIROOT”
SITELIST=$(list_sites.ksh)
if [[ $1 != “” ]];then
SITELIST=$1
fi
for site in $SITELIST; do
setroot -clear
setroot $ROOT $site
if [[ -a $HCISITEDIR/exec/monitorShmemFile ]]; then
### echo “$(hcitcl -c “echo [oth_check_shmem]”)”
echo “$(
hcitcl <<- !
echo [oth_check_shmem]
exit
!
)"
echo "Site: ”
fi
done
Here is the TCL proc ( oth_check_shmem.tcl ) that gets called by the site loop above and does msiAttach:
proc oth_check_shmem {} {
global HciSiteDir
if { [lsearch -exact [ls $HciSiteDir/exec] monitorShmemFile] == -1 } { return }
msiAttach
set msiList [msiTocEntry]
netcfgLoad
set netList [netcfgGetConnList]
lassign [intersect3 $msiList $netList] extraThreads goodThreads x
return $extraThreads
}
After looking at your code I realize I should probably be doing a catch around the msiAttach but never had a problem I know of since I added the check for the shared memory file
$HCISITEDIR/exec/monitorShmemFile
I was able to find one shared memory descrepancy to illustrate the output of running the script. In this example the p_lis_mock site has a shared memory issue indicating somone deviated from our standards and didn’t follow the checklist for modifying a cloverleaf site.
Site:
Site:
Site:
Site:
Site:
Site:
Site:
Site:
Site:
Site:
ob_atc_ors
Site:
Site:
Site:
Site:
Site:
Site:
Site:
Site:
Site:
Site:
Site:
Site:
Site:
Site:
Site:
Site:
Site:
Site:
Site:
Site:
Site:
Site:
Site:
Site:
Site:
Site:
Site:
Site:
Site:
Site:
Site:
Site:
If you’ve never paid much attention to creating standard procedures to follow that take shared memory issues into consideration you might be surprised to find out just how many shared memory issues show up the first time you run this script.
Even though we are aware of some of the pitfalls they still end up surfacing but we have been able to keep them to a minimum as we become more aware and this script has been helpful in making us more aware.
Russ Ross
RussRoss318@gmail.com