Charlie’s rmSite script reminded me of one of my home grown scripts ( set_server_ini_environs.ksh ) I wrote to help me keep my server.ini entries in sorted order.
It can also be run to refresh your server.ini file to accurately reflect the current cloverleaf sites at the time it is run in the event you have deleted, created, or renamed a cloverleaf site on the back-end.
I’ve used it for more than a couple of years with success and found it especially helpful when upgrading the hundreds of cloverleaf sites we have.
Here is set_server_ini_environs.ksh
#!/usr/bin/ksh
# the purpose of this script is to set the environs variable in the server.ini file
# so that it has all our Cloverleaf sites in sorted order
# History:
#
# 2005.08.17 Russ Ross wrote initial version
#
cp -p $HCIROOT/server/server.ini
$HCIROOT/server/server.ini_`date +”%Y.%m.%d_%H:%M:%S”`
perl -pi -e “s,^environs=.*$,`mk_server_ini_environs.ksh`,”
$HCIROOT/server/server.ini
which calls mk_server_ini_environs.ksh
#!/usr/bin/ksh
# the purpose of this script is to create the statement to initialize the environs variable
# which can be redirected to a temp file like x.x and then manually inserted
# into the server.ini file so the Cloverleaf sites will appear in sorted order in the GUI
# History:
#
# 2005.06.21 Russ Ross wrote initial version
envorns_statement=”environs=”
for site in `list_sites.ksh`; do
envorns_statement=”$envorns_statement$HCIROOT/$site;”
done
echo “$envorns_statement” | perl -pi -e “s/;$//”
which calls list_sites.ksh
#!/usr/bin/ksh
# Begin Module Header ==============================================================================
#
#——
# Name:
#——
#
# list_sites.ksh
#
#———
# Purpose:
#———
#
# List all the sites for the current $HCIROOT
#
#——–
# Inputs:
#——–
#
# none
#
#——-
# Notes:
#——-
#
# This script assumes the proper environment is set when it is called
# and all sites are symbolic links at the $HCIROOT level
#
#———
# History:
#———
#
# 2001.02.22 Russ Ross
# – wrote initial version.
#
# 2001.07.25 Russ Ross
# – modified to look for $HCIROOT/*/siteInfo files to determine the list of sites,
# previously had looked for symbolic links in the $HCIROOT directory which only
# works if everyone follows MDACC conventions
#
# 2003.11.17 Russ Ross
# – modified to execlude siteProto from the list of sites
#
# End of Module Header =============================================================================
#—————————————————————————————–
# get a list of all the sites for the current $HCIROOT
# (Note: there is an assumption that all sites are a symbolic link at the $HCIROOT level)
#—————————————————————————————–
(cd $HCIROOT; ls ./*/siteInfo 2>/dev/null) | awk -F/ ‘{print $2}’ | grep -v siteProto | sort
Russ Ross
RussRoss318@gmail.com