My Hercules and Turnkey3 headless server startup script
I wanted to have my hercules system start automatically in a 'headless' server environment. Basically I just wanted it to be running after I hit the power on switch without me having to do anything more energetic than hit the switch (or reboot etc). I was getting a bit tired of having to start for TK3 hercules, then the telnet session and the two 3270 sessions and manually ipl every time I rebooted.
Well I managed to get it to work, but it wasn't at all easy. But it works ok now. Posted here in case anyone else is interested. It is designed to run as an init.d script at startup and shutdown, and has the script headers to allow chkconfig add|on for fedora systems.
After the script runs as part of the normal server reboot
- the TK3 system is fully running, with the hardcopy(telnet) and
two 3270 consoles (a c3270 master console and backup console) running
as screen sessions. And the hercules console itself is
finally available under screen as well.
[mark@osprey ~]$ screen -ls There are screens on: 1606.c3270B (Detached) 1565.c3270A (Detached) 1562.hardcopy (Detached) 991.hercules (Detached) 4 Sockets in /var/run/screen/S-mark. [root@osprey initd]# ps -ef | grep hercules | grep -v grep mark 1838 1 3 17:22 ? 00:00:36 hercules -d -f conf/marks.conf
- as they are screen sessions you can ssh into the 'headless' server and attach/disconnect to/from them as needed if you ever require access to the real console sessions (with 'screen -r xx' where xx is one of hardcopy, c3270A or c3270B or hercules as shown above)
- and then it's fully available, you can connect 3270 TSO sessions from any remote server as needed, just as if you had started the entire hercules environment manually
At server shutdown
Because I managed to get the master console into a screen session, we can cleanly shutdown.
- the F BSPPILOT,SHUTNOW is isuued
- JES2 is cleanly shutdown
- the 'Z EOD' and 'QUIESCE' commands are entered
- then alas the pid of the hercules process is killed, as it is in daemon mode and not a screen session it cannot be cleanly stopped (see the issues section at the end of the script for why)
The script itself
I suppose if you have paged down this far you might actually want the script. The script is here. Feel free to improve on it as you see fit.