Include Page |
---|
| KBCOMMON:KB-CSSstyle |
---|
| KBCOMMON:KB-CSSstyle |
---|
|
...
Method | Comments |
---|
expect | Requires you pass user and password to the script so that it can connect to the console via "telnet " and execute the shutdown commands. The "guest_shutdown.exp " script, located in the /opt/charon/utils folder, can perform operations to: - run the shutdown if the prompt is detected,
- enter a username/password to login if "Console L
ogin: " is detected, - execute the shutdown command if the prompt is detected,
- detect the Main Menu or ISL prompt to issue the "
exit " command.
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: - For MPE/iX systems, this is the only available method. Username and password are then not necessary. Two A <CTRL-A> will be sent on the console then if the "=" prompt is detected the "SHUTDOWN SYSTEM" command will be sent .(other cases are also taken into account like Main menu prompt, ISL> prompt or text garbage on the console)
- 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 HP-UX guest to issue password free remote commands. For more, please read the Tips and Tricks chapter dedicated to rsh trusts. |
ssh | Requires a secured trust to be created between the Linux server and the HP-UX guest (key pair) to issue password and passphrase free remote commands. For more, please read the Tips and Tricks chapter dedicated to ssh trusts. |
...
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.
...
# 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
|
Example:
#!/bin/sh
#
case "$1"
in
/charon/pluto.cfg)
ssh -o ConnectTimeout=2 rp7400 "uptime|cut -f1 -d','" 2>/dev/null
#rsh rp7400 "uptime|cut -f1 -d','" 2>/dev/null
RETVAL=$?
;;
*)
echo "Invalid parameter '$1'"
RETVAL=1
;;
esac
echo "==RETVAL=${RETVAL}=="
exit ${RETVAL}
|
...