Product Documentation and Knowledge Base - HomeDocumentation


Charon-VAXCharon-AXPCharon-PDPCharon-SSPCharon-PAR
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 26 Next »

Table of Contents

Description

This option will allow you 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.

If the script does not exist, it will generated automatically based on existing guests and will by default do nothing. Note that guests added after script creation will have to be inserted manually.

You will have either to add your own shutdown scripts or to get examples provided in the "charon_gstart.stop.example" script located in the "/opt/charon/utils" folder.

Examples are provided for clean shutdown using "ssh" or "expect" thanks to the "guest_shutdown.exp" script given as an example.

(question) "ssh" will require a trust to be created between the Linux server and the Tru64 or OpenVMS guest.

(question) "expect" will require you pass user and password to the script to enable it to connect to the OPA0 console and execute the shutdown commands. The "guest_shutdown.exp" script can perform operations to log off 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) and detect the SRM prompt (>>>) to issue the "power off" command (AXP) or send the F6 key (VAX) if enabled. Note any local existing connection to the console will be killed before executing the expect script. (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.

(lightbulb) When editing this script (/opt/charon/utils/charon_gstart.stop) you will be proposed to edit the example file at the same time to facilitate copy/paste operations if needed.

Explanation on the example file

Example with SSH

(info) Example below is for Tru64. The only difference with OpenVMS is the username and shutdown command to be passed

You will have to create an ssh trust between the CHARON Linux server and the Tru64 guest in order to use this option.

  • Update the configuration file name
  • Replace the existing hostname "pluto" with your Tru64 guest hostname

 

Principle

  1. Check the guest can be accessed via "ssh" (adapt the ConnectTimeout to your needs)
  2. Issue the shutdown command
  3. Wait a few seconds
  4. 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
  5. Kill the emulator process (the shutdown commands does not power off nor stop the emulator process)
  6. Report the stop information within the guest log file

Example with Expect tool, Tru64 guest

You will have here to replace the user (1), password (2) and shell prompt (3) with the ones corresponding to your guest (shell prompt is used to determine if a user is logged on the console)

 

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. Execute the "expect" script and report all output to /opt/charon/console.<guest name>.log. No need to kill the emulator process here as the "power off" command is executed.
 

Example with Expect tool, Tru64 guest, variant for systemd

This example is quite the same as the one above except the "expect" script messages will be made available to the service status.

You will have here to replace the user (1), password (2) and shell prompt (3) with the ones corresponding to your guest (shell prompt is used to determine if a user is logged on the console)

 

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. Execute the "expect" script (1) and report all output to /opt/charon/<guest name>.expect.log. No need to kill the emulator process here as the "power off" command is executed.
  3. Append the output of this file to (2) the /opt/charon/console.<guest name>.log file for history
  4. Search for the "expect" script messages and displays them in stdout (3), they will be logged in the service status.
    Example:
 

Example with Expect tool, AXP VMS guest

You will have here to replace the user (1), password (2) and shell prompt (3) with the ones corresponding to your guest (shell prompt is used to determine if a user is logged on the console)

 

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. Execute the "expect" script and report all output to /opt/charon/console.<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

You will have here to replace the user (1), password (2) and shell prompt (3) with the ones corresponding to your guest (shell prompt is used to determine if a user is logged on the console)

(info) 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 this operation fails, it will exit with return code 9 meaning the emulator process will have to be killed.

 

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. Execute the "expect" script and report all output to /opt/charon/console.<guest name>.log. VAx systems have no "power off" command so the F6 key will be sent.
  3. If the "expect" script returns the error code 9, this means the F6 key is not defined in the configuration and then the emulator process must be killed
  4. 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. 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, for example a ping, an ssh command displaying uptime (Tru64) or boottime (OpenVMS).

 

Display output example:

TODO Update the screeshot below, "Guest running" has changed to "Guest OS response"

Script example:

(lightbulb) In this example, we'll use "ssh" to display the guest "uptime" and the result of the "uname -nr" command (name of the node + release number of the operating system)

# touch /opt/charon/utils/charon_gstart.chkrun

# chmod 744 /opt/charon/utils/charon_gstart.chkrun

# vim /opt/charon/utils/charon_gstart.chkrun

#!/bin/sh

#

# Parameter $1: contains full path to cfg file

#

case "$1"

in

  /charon/myds20.cfg)

    ssh -o ConnectTimeout=2 myds20 "uptime|cut -f1 -d',';uname -nr" 2>/dev/null

    RETVAL=$?

    ;;

  *)

    echo "Invalid parameter '$1'"

    RETVAL=1

    ;;

esac

echo "==RETVAL=${RETVAL}=="

exit ${RETVAL}


Example file provided (contains example for Tru64 and OpenVMS):

 

  • No labels