Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: added note for rsh on RHEL8

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

...

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 (AXP & VAX) if enabled.

This method is useful if the virtual machine has no telnet connection available and cannot handle "rsh" and "ssh" remote connections. For more, please read Tips and Tricks - Shutdown guests with Expect tool.

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

(info) If '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 OpenVMS guest (key pair) to issue password and passphrase free remote commands. For more, please read the Tips and Tricks chapter dedicated to ssh 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 machine.

...

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

...

# Parameter $1: contains full path to cfg file
# Parameter $2: contains full path to emulator exe file
#
# Important notes:
# - comments & commands must be on separate lines
# - respect the structure of the file with case/in/esac
# - only place your commands between the selection and the ';;' line
#
. /opt/charon/utils/charon_common
#
case "$1"
in
  <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.

...

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

...

#
. /opt/charon/utils/charon_common
#
case "$1"
in
  /charon/pluto.cfg)
    ${CHARONDIR}/utils/charon_gstop_ssh $1 $2 pluto5 TRU64
    ;;
  *)
    echo "Invalid parameter '$1'"
    exit 1
    ;;
esac


Div
classpagebreak


Stop script execution example with "ssh" on Red Hat Enterprise Linux 7.9:

...

Example provided for uranus virtual machine (lines to add in blue color):

...
  /charon/uranus.cfg)
    PID=`ps -ef|grep "$2 -d $1"|grep -v grep|awk '{print $2}'`
    if test -n "${PID}"
    then
      kill -9 ${PID}
      sleep 2
      SVC=`basename $1 | sed "s=\.cfg==g"`
      systemctl reset-failed charon_${SVC}
    fi
    exit 0
    ;;
...

(warning) A clean shutdown of the legacy OS is highly recommended.

...