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>" <HPUX/MPEIX>
    #${CHARONDIR}/utils/charon_gstop_rsh $1 $2 <hostname> <HPUX/MPEIX>
    #${CHARONDIR}/utils/charon_gstop_ssh $1 $2 <hostname> <HPUX/MPEIX>
    #/<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.

...

Stop script content example: StatuscolourRedtitleTODO

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

...

Stop script execution example with "ssh" / HP-UX 11.23:

Include Page
KBCOMMON:DOC-GoToToc
KBCOMMON:DOC-GoToToc

Div
classpagebreak


Stop script execution example with "expect" / MPEiX:

Image Added

Image Added

Provided shutdown scripts explanation

...

  • Check if there's an active connection to the console on the local host, kill if any.
  • Execute the /opt/charon/utils/guest_shutdown.exp expect script with the values provided: username (root), password, prompt (for HP-UX only), operating system (either TRU64 HPUX or VMSMPEIX). This script is able to send the shutdown command depending on the returned characters on the console. This can be the SRM prompt ">>>", the "login:" or "username:" prompts or the prompt of the logged in user.
  • Report all output to /opt/charon/log/console.stop.<guest name>.log.

Notes:

  • With Charon-AXPIf the "Main Menu" prompt is found, the "power offexit" command is sent at the SRM promptWith Charon-VAX, the "power off" command does not exist. To power off the virtual machine, the F6 key has to be enabled in the configuration file (set OPA0 stop_on="F6"). If not set, the emulator process is killedto stop the emulator.
  • If the "ISL>" prompt is found, a "reset" command is sent then waits for the "Main Menu" prompt and sends the "exit" command is sent to stop the emulator.
  • (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.

...

  • 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)and reset the service state. (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

...

  • 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)and reset the service state. (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

Include Page
KBCOMMON:DOC-GoToToc
KBCOMMON:DOC-GoToToc

...

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).for HP-UX)

Display output example from the "vmlist" command:

...

Div
classpagebreak


Example:

#!/bin/sh
#
# Parameter $1: contains full path to cfg file
#
case "$1"
in
  
/opt/charon/cfg/pluto.cfg)
    
ssh -o ConnectTimeout=2 pluto "

#!/bin/sh
#
case "$1"
in
  /charon/pluto.cfg)
    ssh -o ConnectTimeout=2 pluto5 rp7400 "uptime|cut -f1 -d','" 2>/dev/null
    RETVAL=$?
    ;;
  *)
    echo "Invalid parameter '$1'"
    RETVAL=1
    ;;
esac
echo "==RETVAL=${RETVAL}=="
exit ${RETVAL}

Div
classsmall

Example file provided (contains example for Tru64/pluto.cfg and OpenVMS/vms.cfg):

#rsh rp7400 "uptime|cut -f1 -d','" 2>/dev/null

    

    RETVAL=$?

    

    ;;
 

/opt/charon/cfg/vms.cfg)
    ssh -o ConnectTimeout=2 system@vms "write sys\$output \"Booted ''f\$getsyi(\"boottime\")'\"" 2>/dev/null
    
RETVAL=$?
    
;;
  

*)

    

    echo "Invalid parameter '$1'"

    

    RETVAL=1

    

    ;;
esac
echo "==RETVAL=${RETVAL}=="
exit ${RETVAL}

Include Page
KBCOMMON:DOC-GoToToc
KBCOMMON:DOC-GoToToc

...