# Presentation: 548838

## A process manager for soft IOCS

- DH Thompson

## ProcServ Goals

- Allow soft IOCs and sequencers to run in the back ground on a unix/linux server without a controlling user session.
- Should not create a glaring security hole.
- Allow IOC engineers to connect, control, monitor and restart the soft IOC.
- Should be stand alone and not need a co-developed client program.  Use telnet.

## ProcServe implementation

- Task starts up and forks a daemon as a new process group leader.
- A pseudo tty master/slave pair is allocated and the soft IOC is started with stdin/stdout/stderr assigned to the slave PTY.
- A user can use telnet at the port specified on the command line to access the master side of the soft IOC’s PTY.
- The server in procServ understands telnet protocols.
- The soft IOC is always restarted (after a delay) if it dies.
- A telnet user can force a reboot of the soft IOC with a ^X, this sends a kill signal to the soft IOC’s process.
- All soft IOC threads are cleaned up when the IOC reboots or the procServ process is killed.

## Startup

- #!/bin/bash
- # Customize this file for your host.
- # This is a starting point!
- cd /ade/epics/iocCommon/ics-tim-linux2
- procServ 7103 /ade/epics/iocCommon/ics-tim-linux2/startup.cmd
- Startup.cmd is an executable script that starts the iocCore binary with st.cmd as the command line parameter.

## Connecting To a proServ Managed IOC

- [thompson@ics-srv-softioc1 ics-tim-linux2]$ telnet localhost 7103
- Trying 127.0.0.1...
- Connected to ics-srv-softioc1 (127.0.0.1).
- Escape character is '^]'.
- procServ: my pid is: 12236
- Startup directory: /ade/epics/iocCommon/ics-tim-linux2
- Startup command: /ade/epics/iocCommon/ics-tim-linux2/startup.cmd
- Welcome to the epics process server!
- Use ^] to quit telnet, and ^X<CR> to reboot the IOC.
- Connected users=1
- epics>
- epics>
- epics> dbcar
- ncalinks 1 not connected 0 no_read_access 0 no_write_access 0
-  nDisconnect 0 nNoWrite 0

## Rebooting the soft IOC with ^X

- epics> Closing the IOC, a new one will be restarted shortly
- Restarting /ade/epics/iocCommon/ics-tim-linux2/startup.cmd
- cd /ade/epics/iocTop/R3.14.4/timingSoftIocs/Development
- dbLoadDatabase("dbd/scope.dbd")
- scope_registerRecordDeviceDriver(pdbbase)
- dbLoadRecords("db/ics-tim-linux2.db","")
- dbLoadRecords("db/service.db","")
- set_requestfile_path /ade/epics/iocTop/R3.14.4/timingSoftIocs/Development/db
- set_savefile_path /ade/epics/iocCommon/ics-tim-linux2/var
- set_pass0_restoreFile ics-tim-linux2.sav
- cd /ade/epics/iocTop/R3.14.4/timingSoftIocs/Development/iocBoot/ics-tim-linux2
- iocInit()
- ############################################################################
- ###  EPICS IOC CORE built on Feb 12 2004
- ###  EPICS R3.14.4 $$Name:  $$ $$Date: 2003/10/18 17:42:28 $$
- ############################################################################
- Starting iocInit

## Bugs

- When stepping through interactive commands in the sequencer you must explicitly type a line feed instead of a carriage return when the tty is in raw single character mode.
- Passwords are not implemented, access is allowed only from the loop back interface on the host.
- Only enough of the telnet protocol is implemented to get by, a framework is there to implement more as needed.
- Needs a log file option in the command line.

## Availability	

- http://Ics-web1.sns.ornl.gov/share/procServer.tgz