I have switched three of our IOC's over to a new scheme for getting
their initialization scripts, described below. If you wanna use
clas-sc8
clas-sc12 (the IOC formerly known as clasgas)
clas-gas (an IOC never known as clasgas)
you will be better off if you understand this scheme. The other IOC we
have been using in Hall B is clas_sc3. This one has been left alone. I
have yet to get to it.
The note supposes some knowledge of the Hall B EPICS directory
structure, a description of which will appear in a future
communication. That is, you should read that one before reading this
one. Since for now it's hard to do that, I'll diagram the structure
quickly here (the level of indentation indicates sub-directory-ness):
/usr/site2/epics_physics/hallb # mother of all directories
hallB # specific release of EPICS (R3.12.0beta8)
base # EPICS base
ascii # ascii files
dev # device support
rec # record support
... # etc.
config # EPICS config files
extensions # EPICS extensions
devel # development version of Hall B stuff
app # our applications
hvca # high voltage control
Target_Wheel # solid target wheel
... # etc.
ioc # our ioc scripts
clas-gas # scripts for clas-gas
clas-sc8 # scripts for clas-sc8
... # etc.
baseB # Hall B additions/modifications to base
ascii # ascii files
dev # device support
rec # record support
... # etc.
prod # production version of Hall B stuff
app # app, like above for devel
ioc # ioc
baseB # baseB
local_files # scripts I use to build this stuff
R3.12.2patch1 # another generic version of EPICS
base # ya
config # da
extensions # ya
devel # da
prod # ya
... # da
Got that? ;)
--
Mark M. Ito, Thomas Jefferson National Accelerator Facility
12000 Jefferson Ave., Mail Stop 12H, Newport News, VA 23606
Email: marki@jlab.org, Office: (757)269-7175, Pager: (757)680-7175
-------------------------------------------------------------------
Mark M. Ito
January 18, 1996
/home/marki/slow/ioc_loading.txt
Version 1
A Scheme for Managing IOC Initialization Scripts
The purpose of this scheme is to facilitate switching a particular IOC
from the use of the production version of our EPICS software to the
development version, or to a private version for testing. The
motivation is that as the role of an IOC changes (adding or deleting
applications) or as the software for a particular application changes
(adding or deleting database files or object code) the initialization
scripts will change, and so in general, the scripts appropriate for
the development version will not work for the production version.
How to Switch Files
-------------------
The point of control for this scheme is an environment
variable, one for each IOC in the system, which is defined in the
.cshrc file of the clasrun account on the unix host (clas10 as of this
writing). The variable is called IOC_root_<iocname>, where <iocname>
is, you guessed it, the name of the IOC. So for example, presently
clasrun's .cshrc contains the line
setenv IOC_root_clas_sc8 /usr/site2/epics_physics/hallb/hallB/prod
for use by clas-sc8. (Environment variables cannot use hyphens. We
will have to fix this up this inconsistency later.) This tells the IOC
to use the production version. To switch the IOC to the development
version, you change this line to
setenv IOC_root_clas_sc8 /usr/site2/epics_physics/hallb/hallB/devel
and reboot the IOC. If you have a private version of the Hall B system
under the directories
/home/me/test/app
/home/me/test/baseB
/home/me/test/ioc
and in particular, you have updated versions of clas-sc8's scripts in
the directory
/home/me/ioc/clas-sc8
then to get the IOC to use them, the line should read
setenv IOC_root_clas_sc8 /home/me/test
These changes will work _without_ changing the name of the startup
file in the boot parameters of the IOC.
What Is the File Name Format in Scripts?
----------------------------------------
For this scheme to work, all references to files that switch when
going from production to development to private must start with the
environment variable. So for example, the script "startup" for
clas-sc8 has the lines
# Define HOME to operational area
HOME="$IOC_root_clas_sc8/ioc/clas-sc8"
cd HOME
and the file "clas-sc8.load" has the lines
cd "$IOC_root_clas_sc8/baseB/bin/mv167"
ld < dbLibB
and
cd "$IOC_root_clas_sc8/app/hvca/db"
dbLoad "ecsc.database"
Note that if a file does _not_ switch between versions, then it need
not be referenced via the environment variable. Again in
"clas-sc8.load" you find the lines
cd "/usr/site2/epics_physics/hallb/hallB/base/bin/mv167"
ld < iocCore
Here the environment variable is _not_ used, since "iocCore" does not
come from the Hall B specific software, rather from a generic EPICS
release directory, and will not switch when versions switch.
Why Go to All This Trouble?
---------------------------
After all, don't we all have better things to do? Unfortunately the
version control scheme used by the "setup_epics" script uses
environment variables and aliases that are not visible to the
IOC's. The IOC's only know about host-defined environment variables
that are defined in .cshrc. "setup_epics" takes several seconds to
execute and is not appropriate for inclusion in .cshrc, and even if we
put it there, such a scheme does not allow for different versions to
be run in different IOC's at the same time.
Are There Other Details?
------------------------
The IOC login username as defined in the IOC boot parameters must be
clasrun. This is so that the correct .cshrc is invoked when the IOC
does remote shell operations on the host. (Actually, this is not
strictly true; it is more accurate to say that the user who has the
.cshrc which defines the environment variable and the user in the boot
parameters must match.)
Is There a Better Way to Do This?
---------------------------------
Probably. Suggestions/debate/criticisms welcome. You know where to
find me.