Versions Compared

Key

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

Anchor
TOC
TOC
Include Page
KBCOMMON:KB-CSSstyle
KBCOMMON:KB-CSSstyle

...

Use this option to edit the stop script that will be executed at service shutdown upon manual request or during the Charon Linux server shutdown procedure.

The script is unique and uses the configuration file (full name) to select commands to be executed at guest shutdown (selected by "case in...").

...

(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.
rsh

Requires:

  • a trust to be created between the Linux server and the Tru64 or OpenVMS guest (proxy) to issue password free remote commands
  • 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 machine.
ssh

Requires:

  • a secured trust to be created between the Linux server and the Tru64 or OpenVMS guest (key pair) to issue password and passphrase free remote commands
  • 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 machine.


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 1 to 5 are explanations on how to setup and prepare the virtual machine and the Charon Linux server (if necessary) to use the three available methods. (lightbulb) You'll find there all the details to setup a proxy for rsh, a key pair for ssh and the necessary firewall settings if needed.
  • Option 6 edits the script. This script in a form of "case in <configuration filename> do ..."
  • Option 7 is used to test the script. Use with caution on production machines.


Info

You'll find in options 1 to 5 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
KBCOMMON:DOC-GoToToc
KBCOMMON:DOC-GoToToc

Common stop script explanation

...

Image Removed


When the script is initialized using option 6 or when a new virtual machine is added, the following lines are added:

...

case "$1"

in

 

<configuration file>

<configuration file>)

    #-- Uncomment and complete one of the following lines:

    #\${CHARONDIR}/utils/charon_gstop_expect \$1 \$2 root <password> "<prompt>" <TRU64/VMS>

    #\${CHARONDIR}/utils/charon_gstop_rsh \$1 \$2 <hostname> <TRU64/VMS>

    #\${CHARONDIR}/utils/charon_gstop_ssh \$1 \$2 <hostname> <TRU64/VMS>

    #/<path>/<myscript>

  ;;

...

esac

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.

Stop script content example:

(info) The editor defined in the Preferences is used to edit the script.

Image Added

Stop script execution example with "rsh":

...

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

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

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


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

...