Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Table of Contents
excludeTable of Contents

Description

Status
colourRed
titleTODO
To rebuil: add rsh. Use the readme files from the kit ?Use this option to edit the stop script that will be executed at service shutdown. The script is unique and uses the configuration file (full name) to select commands to be executed at guest shutdown (selected by "case in...").

If the script does not exist, it will be generated automatically based on existing guests list and will by default do nothing except preparing the script skeleton (warning) If guests are added after the script initialization, they will have to be inserted manually. This consists in adding a chapter for the new configuration file in the "case in..." commandwith commands using the provided script examples to perform the shutdown via either "expect", "rsh" or "ssh". Newly added virtual machines will have their "case" added to the script when it will be edited.

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 or .

If you plan to use the examples provided in the "charon_gstart.stop.example" script located in the "/opt/charon/utils" folder.In this script, examples are provided for clean shutdown using "ssh" or "expect" thanks to the "guest_shutdown.exp" script (provided as an example). See "expect" utility, please read Tips and Tricks - Shutdown guests with Expect tool for more.

Notes:

(lightbulb) Basic knowledge of shell programming is needed to implement the clean shutdown / stop script.

...

MethodComments
expect

Requires you pass user and password to the script

...

so that it

...

can connect to the OPA0 console via

...

"telnet

...

" and execute the shutdown commands. The "guest_shutdown.exp" script, located in the /opt/charon/utils folder, can perform operations to:

  • log off a user connected on the console

...

  • if the prompt is detected

...

  • ,
  • enter a username/password to login

...

  • if "login:" or "username:" is detected

...

  • ,
  • execute the shutdown command

...

  • if the prompt is detected

...

  • ,
  • detect the SRM prompt (>>>) to issue the "power off" command (AXP) or send the F6 key (VAX) if enabled.

This method is useful if the virtual machine has no telnet connection available.

Important notes:

  • Note any local existing connection to the console has to be killed before executing the expect script.

...

  • 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.

...

rshRequires a trust to be created between the Linux server and the Tru64 or OpenVMS guest (proxy)
sshRequires a secured trust to be created between the Linux server and the Tru64 or OpenVMS guest (key pair)



Info
titleNote for Red Hat Enterprise Linux 7.x and CentOS 7.x

If your application and server needs 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.

Example:

[Service]

...

TimeoutStopSec=3min

(info) More information can be found using the "# man systemd.service" command on your Linux server

Options

TO BE CONTINUED

Explanation on the example file

...

(lightbulb) An ssh trust between the CHARON Linux server and the Tru64 guest must have been previously configured in order to use this method. See Tips and Tricks for help to setup the trust.

Image Removed

...

...




...

Principle

  1. Check the guest can be reached via "ssh" (adapt the ConnectTimeout value to your needs), if yes, issue the shutdown command, wait a few seconds and 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
  2. Kill the emulator process (Red Hat Enterprise Linux 6.x) or use the service kill command (RHEL 7.x and CentOS 7.x). Note: the shutdown commands does not power off nor stop the emulator process, that's why this operation is needed
  3. Report the stop information within the guest log file

...

(lightbulb) An ssh trust between the CHARON Linux server and the OpenVMS guest must have been previously configured in order to use this method. See Tips and Tricks for help to setup the trust.

Image Removed

...

...

color#5078D0

...

Principle



  1. Check the guest can be pinged (an "ssh" command as for the Tru64 example above can also be used), if yes, issue the shutdown command, wait a few seconds and 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
  2. Kill the emulator process (Red Hat Enterprise Linux 6.x) or use the service kill command (RHEL 7.x and CentOS 7.x). Note: the shutdown commands does not power off nor stop the emulator process, that's why this operation is needed
  3. Report the stop information within the guest log file

...

Example with Expect tool, Tru64 guest

Image Removed

...

color#5078D0

...




  1. Check if there's an active connection to the console on the local host, kill if any.
    Reminder: (warning) 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.
  2. Replace the user (EXPUSR), password (EXPPWD) and shell prompt (EXPPRT) with the ones corresponding to your guest (shell prompt is used to determine if a user is logged on the console)
  3. Execute the "expect" script and report all output to /opt/charon/log/console.stop.<guest name>.log. Note: no need to kill the emulator process here as the "power off" command is executed.

...

Example with Expect tool, AXP VMS guest

Image Removed

Highlight
color#5078D0

Principle




  1. Check if there's an active connection to the console on the local host, kill if any.
    Reminder: (warning) 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.
  2. Replace the user (EXPUSR), password (EXPPWD) and shell prompt (EXPPRT) with the ones corresponding to your guest (shell prompt is used to determine if a user is logged on the console)
  3. Execute the "expect" script and report all output to /opt/charon/log/console.stop.<guest name>.log. No need to kill the emulator process here as the "power off" command is executed.

...

Example with Expect tool, VAX VMS guest

Image Removed

Highlight
color#5078D0

Principle




  1. Check if there's an active connection to the console on the local host, kill if any.
    Reminder: (warning) 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.
  2. Replace the user (EXPUSR), password (EXPPWD) and shell prompt (EXPPRT) with the ones corresponding to your guest (shell prompt is used to determine if a user is logged on the console)
  3. Execute the "expect" script and report all output to /opt/charon/log/console.stop.<guest name>.log.
    1. VAX systems have no "power off" command so the F6 key will be sent.
    2. The F6 key can be enabled or not in the configuration file. The expect script will send it if the "power off" command fails and if F6 operation fails, it will exit with return code 9 meaning the emulator process will have to be killed.
    3. If the "expect" script returns the error code 9, this means the F6 key is not defined in the configuration file and then the emulator process must be killed
    4. Report the stop information within the guest log file

...

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:Image Removed


Div
classpagebreak


...