PROCSERV(1) | procServ Manual | PROCSERV(1) |
NAME¶
procServ - Process Server with Telnet Console and Log Access
SYNOPSIS¶
procServ [OPTIONS] -P endpoint... command args...
procServ [OPTIONS] endpoint command args...
DESCRIPTION¶
procServ(1) creates a run time environment for a command (e.g. a soft IOC). It forks a server run as a daemon into the background, which creates a child process running command with all remaining args from the command line. The server provides control access (stdin/stdout) to the child process console by offering a telnet connection at the specified endpoint(s).
An endpoint can either be a TCP server socket (specified by the port number) or a UNIX domain socket (where available). See ENDPOINT SPECIFICATION below for details. For security reasons, control access is restricted to connections from localhost (127.0.0.1), so that a prior login in to the host machine is required. (See --allow option.)
The first variant allows multiple endpoint declarations and treats all non-option arguments as the command line for the child process. The second variant (provided for backward compatibility) declares one endpoint with its specification taken from the first non-option argument.
procServ can be configured to write a console log of all in- and output of the child process into a file using the -L (--logfile) option. Sending the signal SIGHUP to the server will make it reopen the log file.
To facilitate running under a central console access management (like conserver), the -l (--logport) option creates an additional endpoint, which is by default public (i.e. TCP access is not restricted to connections from localhost), and provides read-only (log) access to the child’s console. The -r (--restrict) option restricts both control and log access to connections from localhost.
Both control and log endpoints allow multiple connections, which are handled transparently: all input from control connections is forwarded to the child process, all output from the child is forwarded to all control and log connections (and written to the log file). All diagnostic messages from the procServ server process start with "@@@" to be clearly distinguishable from child process messages. A name specified by the -n (--name) option will replace the command string in many messages for increased readability.
The server will by default automatically respawn the child process when it dies. To avoid spinning, a minimum time between child process restarts is honored (default: 15 seconds, can be changed using the --holdoff option). This behavior can be toggled online using the toggle command ^T, the default may be changed using the --noautorestart option. You can restart a running child manually by sending a signal to the child process using the kill command ^X. With the child process being shut down, the server accepts two commands: ^R or ^X to restart the child, and ^Q to quit the server. The -w (--wait) option starts the server in this shut down mode, waiting for a control connection to issue a manual start command to spawn the child.
Any connection (control or log) can be disconnected using the client’s disconnect sequence. Control connections can also be disconnected by sending the logout command character that can be specified using the -x (--logoutcmd) option.
To block input characters that are potentially dangerous to the child (e.g. ^D and ^C on soft IOCs), the -i (--ignore) option can be used to specify characters that are silently ignored when coming from a control connection.
To facilitate being started and stopped as a standard system service, the -p (--pidfile) option tells the server to create a PID file containing the PID of the server process. The -I (--info-file) option writes a file listing the server PID and a list of all endpoints.
The -d (--debug) option runs the server in debug mode: the daemon process stays in the foreground, printing all regular log content plus additional debug messages to stdout.
ENDPOINT SPECIFICATION¶
Both control and log endpoints may be bound to either TCP or UNIX sockets (where supported). Allowed endpoint specifications are:
<port>
<ifaceaddr>:<port>
unix:</path/to/socket>
unix:<user>:<group>:<perm>:</path/to/socket>
unix:@</path/to/socket>
OPTIONS¶
--allow
--autorestartcmd=char
--coresize=size
-c, --chdir=dir
-d, --debug
-e, --exec=file
-f, --foreground
-h, --help
--holdoff=n
-i, --ignore=chars
*-I, --info-file <file>
-k, --killcmd=char
--killsig=signal
-l, --logport=endpoint
-L, --logfile=file
--logstamp[=fmt]
-n, --name=title
--noautorestart
-P, --port=endpoint
-p, --pidfile=file
--timefmt=fmt
-q, --quiet
--restrict
-V, --version
-w, --wait
-x, --logoutcmd=char
USAGE¶
To start a soft IOC using procServ, change the directory into the IOC’s boot directory. A typical command line would be
procServ -n "My SoftIOC" -i ^D^C 20000 ./st.cmd
To connect to the IOC, log into the soft IOC’s host and connect to port 20000 using
telnet localhost 20000
To connect from a remote machine, ssh to a user account on procservhost and connect to port 20000 using
ssh -t user@procservhost telnet localhost 20000
You will be connected to the soft IOCs console and receive an informative welcome message. All output from the procServ server will start with "@@@" to allow telling it apart from messages that your IOC sends.
> telnet localhost 20000
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
@@@ Welcome to the procServ process server (procServ Version 2.1.0)
@@@ Use ^X to kill the child, auto restart is ON, use ^T to toggle auto restart
@@@ procServ server PID: 21413
@@@ Startup directory: /projects/ctl/lange/epics/ioc/test314/iocBoot/iocexample
@@@ Child "My SoftIOC" started as: ./st.cmd
@@@ Child "My SoftIOC" PID: 21414
@@@ procServ server started at: Fri Apr 25 16:43:00 2008
@@@ Child "My SoftIOC" started at: Fri Apr 25 16:43:00 2008
@@@ 0 user(s) and 0 logger(s) connected (plus you)
Type the kill command character ^X to reboot the soft IOC and get server messages about this action.
Type the telnet escape character ^] to get back to a telnet prompt then "quit" to exit telnet (and ssh when you were connecting remotely).
Though procServ was originally intended to be an environment to run soft IOCs, an arbitrary process might be started as child. It provides an environment for any program that requires access to its console, while running in the background as a daemon, and keeping a log by writing a file or through a console access and logging facility (such as conserver).
ENVIRONMENT VARIABLES¶
PROCSERV_PID
PROCSERV_DEBUG
KNOWN PROBLEMS¶
None so far.
REPORTING BUGS¶
Please report bugs using the issue tracker at https://github.com/ralphlange/procServ/issues.
AUTHORS¶
Originally written by David H. Thompson (ORNL). Current author: Ralph Lange <ralph.lange@gmx.de>.
RESOURCES¶
GitHub project: https://github.com/ralphlange/procServ
COPYING¶
All copyrights reserved. Free use of this software is granted under the terms of the GNU General Public License (GPLv3).
01/18/2017 | procServ 2.7.0 |