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

Description

Status
colourRed
titleTODO

Allows to add commands to be executed before the virtual machine is started (optional).

The script will be initialized upon first edition and will be prepared for the existing virtual machines. Newly added virtual machines will be automatically added upon edition.

Usage

(warning) It is important to respect the rules described in the menu or inside the script.

Image Removed

Example: activation of port 1 on the SEH myUTN-50a USB/Ethernet box before starting the Charon emulatorIt is possible to display a line that is the result of a command sent to the legacy operating system running on the guest or a result of a "ping" done locally that can give information on the guest system. For example, the uptime can be returned (rsh or ssh needed) and added to the displayed guests list.

Display output example from the "vmlist" command:

Image Added

Note

If the script has been initialized and a new virtual machine is added, it must be edited for the case related to the new configuration file to be added otherwise the "Invalid parameter" case will be displayed (this does not prevent the script from running).

Usage

Select option 1 to edit the script and option 2 to verify the commands entered work correctly:

Image Added

Script example

(lightbulb) In this example, "ssh" is used to display the guest "uptime" for a Tru64 UNIX guest and "rsh" is used to write the boot time of an OpenVMS guest.


(warning) The last 2 lines containing the RETVAL variable are mandatory.

Example:

/usr/bin/utnm -c "activate utn50agvalab 1"


#!/bin/sh
#

# 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
# - do not add any 'exit' command in the script unless you want the
#   virtual machine not to be started if the script fails
#
. /opt/charon/utils/charon_common
#
case "$1"
in
  
/charon/pluto.cfg)
    

case "$1"
in
  
/charon/pluto.cfg)
    
ssh -o ConnectTimeout=2 pluto5 "uptime|cut -f1 -d','" 2>/dev/null
    
RETVAL=$?
    
;;
  
/charon/myds20vms.cfg)
    
rsh -l system ds20vms 'write sys$output "Booted ",f$getsyi("boottime")' 2>/dev/null
    
RETVAL=$?
    
;;
  
*)
    
echo "Invalid parameter '$1'

for prestart

"
    

exit

RETVAL=1
    
;;
esac

(question) The example above would need enhancement as if the port is already connected, an error will be returned. A test before activation is then welcome.

Note

If the script has been initialized and a new virtual machine is added, it must be edited for the case related to the new configuration file to be added otherwise the "Invalid parameter" case will be activated and the "exit 1" will prevent the virtual machine from starting.

When displaying the list of defined virtual machines, the first 3 lines of the pre-start commands are displayed:

...

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




















Note: when the script is initialized, example are provided and need to be uncommented depending on your needs. It is of course possible to add your own commands.

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