Anchor | ||||
---|---|---|---|---|
|
Include Page | ||||
---|---|---|---|---|
|
...
To be able to perform a clean shutdown of your Tru64 or OpenVMS virtual machine, you will have either to use the provided scripts (see above) or to add your own shutdown scripts.
...
Method | Comments |
---|---|
expect | Requires you pass user and password to the script so that it can connect to the OPA0 console via "
login: " or "username
>>> )
power off
This method is useful if the virtual machine has no telnet connection available and cannot handle " Important notes:
|
rsh | Requires : a trust to be created between the Linux server and the Tru64 or OpenVMS guest (proxy)HP-UX guest to issue password free remote commands. For more, please read the Tips and Tricks chapter dedicated to rsh trusts. if the virtual machine is running OpenVMS, the CHARON_SHUTDOWN.COM script, located in the /opt/charon/utils folder, has to be copied in the SYS$MANAGER folder on the OpenVMS machineIf 'rsh' is not installed on the Linux server, please run "# yum install rsh" (CentOS7/RHEL7) or "dnf install rsh" (CentOS8). For RHEL 8, please read the Tips and Tricks chapter dedicated to rsh installation on RHEL8. |
ssh | Requires : a secured trust to be created between the Linux server and the Tru64 or OpenVMSHP-UX guest (key pair) to issue password and passphrase free remote commands. For more, please read the Tips and Tricks chapter dedicated to ssh trusts. |
Div | ||
---|---|---|
| ||
Info | ||
| ||
If your application and server need time to shutdown, it could be necessary to give more time in the service definition to prevent from the service stop procedure to fail due to timeout.
To do so, open the "Manage 'systemd' services
" option and edit the service configuration file. You can then add the TimeoutStopSec=
parameter in the Service
section. The default value is 20 minutes and can be changed in the preferences menu options.
Example:
|
More information can be found using the "# man systemd.service
" command on your Linux server
Options
- Options 1 to 5 3 are explanations on how to setup and prepare the virtual machine and the Charon Linux server (if necessary) to use the three available methods.
- Option 6 4 edits the script. This script is in a form of "case in <configuration filename> do ..."
- Option 7 5 is used to test the script. Use with caution on production machines.
...
You'll find in options 1 to
...
3 all the details to setup the remote connection: packages to install, proxy settings for rsh, key pair definition for ssh (password and passphrase free), the necessary firewall settings if needed, etc...
Include Page | ||||
---|---|---|---|---|
|
...
When the script is initialized using option 6 or when a new virtual machine is added, the following lines are added:
...
...
|
One of the blue colored lines above has to be uncommented depending on the method chosen. Other lines can remain in the script or can be deleted.
...
- The values between the < and > signs have to be filled manually.
- The operating system must be set to either TRU64 HPUX or VMS MPEIX (case insensitive).
- If the "rsh" or "ssh" method is used, the <hostname>, corresponding to the virtual machine hostname, must be known by the Charon Linux server.
- if MPEIX is defined, only the "expect" method can be used. Username, password and prompt can be set to "X" as they are not needed. Example:
${CHARONDIR}/utils/charon_gstop_expect \$1 \$2 X X X MPEIX
Stop script content example:
...
...
|
...
Stop script execution example with "ssh" on Red Hat Enterprise Linux 7.8/ HP-UX 11.23:
Include Page | ||||
---|---|---|---|---|
|
Div | ||
---|---|---|
| ||
Stop script execution example with "expect" / MPEiX:
Provided shutdown scripts explanation
...
title | Note for Red Hat Enterprise Linux/CentOS 7 and 8 |
---|
Whatever the shutdown script execution result is, the stop request sent by the systemctl
command will stop the emulator. It is very important then to ensure the stop script has been tested and validated.
charon_gstop_expect
- Check if there's an active connection to the console on the local host, kill if any.
- Execute the /opt/charon/utils/guest_shutdown.exp expect script with the values provided: username (root), password, prompt (for HP-UX only), operating system (either TRU64 HPUX or VMSMPEIX). This script is able to send the shutdown command depending on the returned characters on the console. This can be the SRM prompt ">>>", the "login:" or "username:" prompts or the prompt of the logged in user.
- Report all output to
/opt/charon/log/console.stop.<guest name>.log
.
Notes:
- With Charon-AXPIf the "Main Menu" prompt is found, the "
power off
exit
" command is sent at the SRM promptWith Charon-VAX, the "power off
" command does not exist. To power off the virtual machine, the F6 key has to be enabled in the configuration file (set OPA0 stop_on="F6"
). If not set, the emulator process is killedto stop the emulator. - If the "ISL>" prompt is found, a "
reset
" command is sent then waits for the "Main Menu" prompt and sends the "exit" command is sent to stop the emulator. - If the console is locked from an external connection or if the prompt is not detected after sending a carriage return, the expect script will fail.
Div | ||
---|---|---|
| ||
charon_gstop_rsh
Check the guest can be reached via ping, if yes:
Issue the
shutdown
command via "rsh" (depends on the operating system),Wait for a few seconds
Check if the guest can be "pinged" and repeat with an interval of 5 seconds
If the guest cannot be pinged, assume the shutdown procedure is complete
Kill the emulator process (Red Hat Enterprise Linux 6.x) or use the
service kill
command (RHEL/CentOS 7 and 8)and reset the service state. The shutdown commands does not power off nor stop the emulator process, that's why this operation is neededReport the stop information within the guest log file
...
charon_gstop_ssh
Check the guest can be reached via ping, if yes:
Issue the
shutdown
command via "ssh" (depends on the operating system),Wait for a few seconds
Check if the guest can be "pinged" and repeat with an interval of 5 seconds
If the guest cannot be pinged, assume the shutdown procedure is complete
Kill the emulator process (Red Hat Enterprise Linux 6.x) or use the
service kill
command (RHEL/CentOS 7 and 8)and reset the service state. The shutdown commands does not power off nor stop the emulator process, that's why this operation is needed- Report the stop information within the guest log file
...
Optional guest display status script
It is possible to create a script, "/opt/charon/utils/charon_gstart.chkrun
" (an example is provided in the 'charon_gstart.chkrun.example
' file) that will add a status line while displaying the guests list for running guests only. This script, if needed, has to be created manually and must be executable.
This status line is the result of the command you executed for that guest (known by its configuration file), for example a ping
, an ssh
command displaying uptime
(Tru64) or boottime
(OpenVMS).
Display output example from the "vmlist
" command:
...
In this example, we use "ssh
" to display the guest "uptime
".
The last 2 lines containing the RETVAL variable are mandatory
To create the script, the following commands were executed to copy the provided example to the one that will be used:
...
# cp /opt/charon/utils/charon_gstart.chkrun.example
/opt/charon/utils/charon_gstart.chkrun
# chmod 744 /opt/charon/utils/charon_gstart.chkrun
# vim /opt/charon/utils/charon_gstart.chkrun
...
class | pagebreak |
---|
Example:
...
#!/bin/sh
#
case "$1"
in
/charon/pluto.cfg)
ssh -o ConnectTimeout=2 pluto5 "uptime|cut -f1 -d','" 2>/dev/null
RETVAL=$?
;;
*)
echo "Invalid parameter '$1'"
RETVAL=1
;;
esac
echo "==RETVAL=${RETVAL}=="
exit ${RETVAL}
Example file provided (contains example for Tru64/pluto.cfg and OpenVMS/vms.cfg):
...
class | small |
---|
...
Include Page | ||||
---|---|---|---|---|
|