Experimental Physics and Industrial Control System
|
Hello Kay,
On 6/26/19 3:48 PM, Kasemir, Kay via Tech-talk wrote:
To test a client for an IOC that keeps restarting, I tried this:
while true
do
softIoc brief.cmd
done
with brief.cmd like this:
dbLoadDatabase("/path/to/softIoc.dbd")
dbLoadRecords("demo.db")
iocInit()
epicsThreadSleep(10)
date()
exit()
The IOC starts, after 10 seconds the date is printed, but instead of then exiting, I get the "epics>" prompt.
Same when I don't include "exit()".
Why does exit() in the startup script not exit?
It exits the iocShell instance that is taking commands from your startup script, but doesn't exit the IOC process. We normally start a second iocShell instance to accept commands from stdin. If you don't want that second interactive iocShell instance to be
run, pass the option '-S' to the softIoc executable. However doing that won't actually cause the IOC to exit, it just hangs up the main thread and allows the IOC to continue to run. An IOC in this state cannot be stopped using Control-C either, you have to
use kill -9 for it to die, or have it commit suicide as follows:
The softIoc can load an exit subroutine (similar to the SYSRESET PV that Mike mentioned but with a built in subroutine) which will cause the IOC to exit when you process it (which you can do through CA). You use the option '-x <prefix>' to load a subrecord
called '<prefix>:exit', or you can load your own subroutine record with SNAM=exit (see your Base/db/softIocExit.db file for details). You can control the exit status of the IOC process by setting <prefix>:exit.A to a non-zero value for it to return EXIT_FAILURE.
BTW if all you want is to load one or more databases with macros and run iocInit you don't need a startup script at all, you can just do this:
while true
do
softIoc -m VAR=value -d demo.db -x testIoc -S
done
Your demo.db would have to process the exit PV itself after 10 seconds for the IOC to quit though. You can have as many '-m ... -d ...' options on the command-line as you like to set macro values and load databases. It can even load an access security control
file too (-a filepath).
HTH,
- Andrew
--
Complexity comes for free, Simplicity you have to work for.
|
- References:
- How is 'exit()' different for the IOC shell? Kasemir, Kay via Tech-talk
- Navigate by Date:
- Prev:
Re: How is 'exit()' different for the IOC shell? Zelazny, Michael Stanley via Tech-talk
- Next:
Re: How is 'exit()' different for the IOC shell? Konrad, Martin via Tech-talk
- 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:
Re: How is 'exit()' different for the IOC shell? Zelazny, Michael Stanley via Tech-talk
- Next:
Re: How is 'exit()' different for the IOC shell? Konrad, Martin via Tech-talk
- 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
|
ANJ, 26 Jun 2019 |
·
Home
·
News
·
About
·
Base
·
Modules
·
Extensions
·
Distributions
·
Download
·
·
Search
·
EPICS V4
·
IRMIS
·
Talk
·
Bugs
·
Documents
·
Links
·
Licensing
·
|