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

...

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.

...

  • 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). (question) 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

Div
classpagebreak


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). (question) 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

...

# 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


Div
classpagebreak


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}

...