> >> I know I can use
> >> ==========================================
> >> dbLoadRecords ("db/test.db","device=${DEV},channel=1")
> >> dbLoadRecords ("db/test.db","device=${DEV},channel=2")
> >> dbLoadRecords ("db/test.db","device=${DEV},channel=3")
> >> dbLoadRecords ("db/test.db","device=${DEV},channel=4")
> >> ==========================================
> >> in st.cmd script and epics will get the system environment "DEV" so
> >> that I don't need to modify my ioc package and just use
> >> export DEV=blahblah
> >> on each device. But I kind of like my st.cmd script to be clean and
> >> neat, thus I made some .substitutions file like:
> >> ======================
> >> file "db/test.db" {
> >> pattern { device, channel }
> >> { "${DEV}", 1 }
> >> { "${DEV}", 2 }
> >> { "${DEV}", 3 }
> >> { "${DEV}", 4 }
> >> }
> >> ======================
Since there really isn't much difference in content between these two, you can
still achieve a clean and neat st.cmd file by moving all of the dbLoadRecords
commands into a secondary script that you include from the main one:
== st.cmd ==================
# Load test.db for ${DEV}, channels 1 through 4
< loadTestDatabase.cmd
============================
== loadTestDatabase.cmd ====
dbLoadRecords ("db/test.db","device=${DEV},channel=1")
dbLoadRecords ("db/test.db","device=${DEV},channel=2")
dbLoadRecords ("db/test.db","device=${DEV},channel=3")
dbLoadRecords ("db/test.db","device=${DEV},channel=4")
============================
> I need testAll.db to be loaded many times so I don't like to put a lot of
> dbLoadRecords commands in the st.cmd script. Besides, I have like
> five or six macros in the .db file so that I can make it universal to the
> instruments in my charge. But when it appears in the st.cmd script, it's
> a long line and not supposed to be broken into several lines which,
> I'm sorry, doesn't seem perfect to me. While if I use the "pattern" form
> of a .substitutions template, the macros are just grouped logically.
> It's very nice except it can't accept the system environment.
My philosophy about this kind of question is that I really don't like taking
initialization values or paths from environment variables, because it makes
it harder to reproduce the same boot conditions at a later date. All it
takes is for someone to manually set a few environment variables before
starting the IOC and you now can't come back three weeks later and get
exactly the same result unless you remember exactly what those settings were
â do you keep your ~/.login or ~/.profile files under CVS/SVN control?
In an operational control system reproduceability is important, so IMHO all
initialization values should be given in startup scripts or .substitutions
files that can be saved to a revision control system. That's why I wouldn't
*want* the IOC to expand environment variables in a .substitutions file
(although I believe they do work in the filenames, because they get expanded
in a different point of the code).
HTH,
- Andrew
--
Talk is cheap. Show me the code. -- Linus Torvalds
- References:
- How to pass system environment to .substitutions? Zhichu Chen
- Fwd: How to pass system environment to .substitutions? Zhichu Chen
- Navigate by Date:
- Prev:
Re: Recommended display manager? Kasemir, Kay (ky9)
- Next:
Extending EDM's supported PVs/data acquisition protocols Carl Schumann
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
<2008>
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
Fwd: How to pass system environment to .substitutions? Zhichu Chen
- Next:
Agenda for Padua Dalesio, Leo
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
<2008>
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
|