Yes I too wanted a sorted listing and have even been thinking about some visual delimiters.
It is easier for me just to share my approach and let you decide than for me to evalute your approach.
Nonetheless, I just looked and right now I have 94 test sites and 57 production sites, so you can see my similar need to order sites so I can locate the one of interest.
My approach was a bit different because I don’t always use the GUI to create or change a site name so I have sites that sometimes are not even in the server.ini file.
My approach does the follwoing
– makes a bakup copy of server.ini file
– dynamically creates current listing of all sites of interest
– uses current site listing to replace “environs=” stuff in server.ini
I wrote the following 3 scripts to accomplish this:
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
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/;$//”
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