- Introduction
- How to run in "No UI" mode
- Using the HTTP Server to control Hercules running in No UI mode
In addition to being able to run Hercules in normal Panel/HMC mode or in External GUI mode, it is also able to run in a mode known as "No-UI" (No User Interface) mode.
"No UI" mode is similar to -- (but is not the same as!) -- running in "daemon" mode.
A daemon is a computer program that runs as a background process (usually, but not always, invisibly), rather than being under the direct control of an interactive user. On Windows platforms these are known as services. On Unix and related platforms, they are known as daemons, but the concept is the same.
Running Hercules in No-UI mode allows you to start an instance of Hercules (with no terminal/panel/keyboard user interface) that continues to run, even should you decide to logoff from your host operating system.
This can prove to be quite convenient when using Hercules as a Shared Device Server that, by serving other Hercules Shared Device Client instances, must therefore always be running (whereas the normal Hercules client instances can come and go (startup and shutdown) at will, any time they want).
To run Hercules in No UI mode, simply specify the --NoUI or -n command line option when you start Hercules:
(Linux):
hercules --NoUI --config=hercules.cnf --logfile=hercules.log < /dev/null > /dev/null 2>&1
(Windows):
hercules --NoUI --config=hercules.cnf --logfile=hercules.log < NUL > NUL 2>&1
When Hercules runs in No UI mode, it does not write or read anything to/from the HMC (hardware panel/terminal). It only writes messages to the specified logfile.
As you can see in the above example, stdout and stderr are both being redirected to /dev/null since, when run in No UI mode, all messages are written to the specified logfile instead.
Additionally, stdin is also being redirected from /dev/null as well, since, when run in No UI mode, Hercules will never read from stdin. Instead, it loops forever until it receives the quit or exit command.
For this reason, you must supply some other means for issuing commands to Hercules. The most common and perhaps simplest way to do this is to use Hercules's built-in "HTTP Server" feature, via the
HTTP PORT, HTTP ROOT and HTTP START
configuration file statements:
# Shared Device Server with no guest (i.e. NUMCPU 0)
NUMCPU 0
HTTP ROOT ~/hercules/hyperion/html
HTTP PORT 8181 AUTH username password
HTTP START
# Shared Dasd devices...
0123 3390 "FOO001.cckd64" ro cu=3990-6
0124 3390 "BAR002.cckd64" ro cu=3990-6
0125 3390 "FOOBAR.cckd64" ro cu=3990-6
WARNING! If you fail to provide some means for issuing commands to Hercules, you will not be able to shut it down! In such a situation your only choice is to use you host operating system to forcibly "kill" the Hercules process!
In the above example configuration file, NUMCPU 0 is specified because, in this particular example, Hercules is acting solely as a Shared Device Server, wherein no guest operating system is ever IPLed. Instead, Hercules simply waits for Shared Device Clients to connect to it, so that it can then service the client's I/O requests.
Running Hercules in this manner is not a requirement for running in No UI mode however. It is simply a common reason for doing so. There is nothing stopping you from running a normal guest configuration in No UI mode. In such a situation your Hercules configuration file would look just like normal, with the notable exception of always having a working HTTP PORT, ROOT and START statement in it so that you will have some way of communicating with Hercules in order to eventually issue the quit command to shut it down.
To use Hercules's HTTP Server, simply open your browser and surf to the following URL:
http://127.0.0.1:8181
where "127.0.0.1" is the IP address of the system where Hercules is running (in this case the local machine), and "8181" is port number that the server is listening for connections on (as specified in your HTTP PORT configuration file statement).
The HTTP ROOT statement specifies the root directory where the HTTP Server's files reside. This is usually the "html" subdirectory of Hercules's distributed source code where all of the Server's required files exist.
Once connected, you should then see a web page that looks like this:
From this web page you should be able to view registers, device information, Hercules documentation, and most importantly, view Hercules messages and issue commands, thereby allowing you to completely control Hercules.
It is from this HTTP Server webpage that you can enter the Hercules quit or exit command whenever you are ready to shutdown your Hercules.

