Chapter 6: Run IOCs with iocsh.bash
Run an Input/Output Controller (IOC) using installed module support without
compiling an application binary. The iocsh.bash loader resolves module
dependencies, loads shared libraries and database definition (DBD) files, and
starts softIocPVX with your startup configuration.
Complete Chapter 1 first. Lessons 6.2 and 6.3 reuse the simulator scripts, databases, protocols, and fragments created in Chapters 3 and 4.
- Run an IOC with installed modules:
inspect
iocsh.bash -noutput, loadbusy, and verify Channel Access (CA) and pvAccess (PVA) access. - Connect the TCP simulator:
run single-device and three-device
StreamDevicestartups by reusingtraining_device.iocshunchanged. - Read 32 temperature channels:
load
TC-32.dband expose a compositeQSRV2group process variable (PV) withdbLoadGroup. - Add host statistics, autosave, and regex search:
combine
linStat,autosave, andretoolswithcommonIocshto persist a setpoint across restarts. - Module selection and loader errors:
pin module versions, check exported macros in
cfg/iocsh.conf, and reproduce four startup error checks.
iocsh.bash loads installed record and device support. Application-specific C
or C++ code requires a compiled IOC application as shown in Chapters 2 through
5.
Chapter exercises
- In lesson 6.3, add a
ch08scalarmapping for$(P)$(R)CH08.VALtotc32_group.json. Stoptc32_emulator.bashin terminal 1 with Ctrl+C, enterexitin terminal 2, start./tc32_emulator.bash --port 9399again in terminal 1, and restartiocsh.bash st.cmdin terminal 2. Confirm thatpvxgl(1, "*")reportsAtomic Members:5andpvxget LOADER:TC32:Summaryincludesch08.value. - In lesson 6.4, add a second
aorecord named$(P)Limitwithfield(PINI, "YES")andinfo(autosaveFields, "VAL"). Write a value withcaput, wait 6 seconds, restart the IOC, and verify thatsettings.savrestores both records. - Run
iocsh.bash -nonst.cmdfrom lesson 6.4 and explain whycommonIocshfragments (linStat.iocshandautosave.iocsh) useiocshLoadrather thanmoduledirectives.
Before moving on
- Every
iocsh.bash(softIocPVX) session is stopped withexit. - Every
tcpserver.bashandtc32_emulator.bashprocess is stopped with Ctrl+C. -
ss -ltn 'sport = :9399 or sport = :9400 or sport = :9401'reports no active TCP listeners. - Temporary scratch directories from lessons 6.1 and 6.5 are removed or noted outside the EPICS distribution tree.