Knowledge Base

|
Customizing the ESX Server Banner Page
Details
Solution
The banner page file is located at /usr/sbin/vmkstatus.
***************BEGIN SAMPLE vmkstatus file**************
#!/bin/sh
VERSION="1.5.0"
PRODUCT="VMware ESX Server"
HOSTNAME=`hostname 2>/dev/null`
HOSTNAME=${HOSTNAME:-localhost}
DOC_URL="
http://www.vmware.com/support/esx15/doc/"
TTY="/dev/tty1"
FAST_PERIOD=10
SLOW_PERIOD=120
MAX_ITERATIONS=600
PERIOD=$FAST_PERIOD
TRAP_COMMAND='echo'
# Trap all signals that we can trap
for i in 1 2 3 4 5 6 7 8 10 11 12 13 14 15 17 20 21 22 23 24 25 26
27 28 29 30 3
1; do
trap "$TRAP_COMMAND" $i
done
RES_LIN=3
RES_COL=12
INIT_LOC=`echo -en "\\033[${RES_LIN};${RES_COL}H"`
BLACK=`echo -en "\\033[0;30m"`
RED=`echo -en "\\033[0;31m"`
GREEN=`echo -en "\\033[0;32m"`
YELLOW=`echo -en "\\033[0;33m"`
BLUE=`echo -en "\\033[0;34m"`
MAGENTA=`echo -en "\\033[0;35m"`
CYAN=`echo -en "\\033[0;36m"`
WHITE=`echo -en "\\033[0;37m"`
BOLD_BLACK=`echo -en "\\033[1;30m"`
BOLD_RED=`echo -en "\\033[1;31m"`
BOLD_GREEN=`echo -en "\\033[1;32m"`
BOLD_YELLOW=`echo -en "\\033[1;33m"`
BOLD_BLUE=`echo -en "\\033[1;34m"`
BOLD_MAGENTA=`echo -en "\\033[1;35m"`
BOLD_CYAN=`echo -en "\\033[1;36m"`
BOLD_WHITE=`echo -en "\\033[1;37m"`
NORMAL=`echo -en "\\033[0m"`
TITLE="${INIT_LOC}Welcome to ${BOLD_CYAN}${PRODUCT}${NORMAL}
version $VERSION"
# VMnix is not running
show_initial_page() {
cat <<EOF
$TITLE
To configure your system, please go to another machine and
point a Web browser to this machine. For example, if the
external hostname of this machine is $HOSTNAME,
then open your browser to the following URL:
${BOLD_WHITE}
http://$HOSTNAME/${NORMAL}
If you want direct shell access to the ${BOLD_RED}Console
OS${NORMAL}, you may p
ress
Alt-F2 to switch to a virtual terminal where you may log in.
For more information please see the on-line documentation at
${BOLD_WHITE}${DOC_URL}${NORMAL}
EOF
}
# VMnix is running but vmware-config has not been run yet
show_stage2_page() {
cat <<EOF
$TITLE
Your system is not fully configured. If you are using the
web-based setup wizard from another machine, you may press
the
"Next to System Setup" button on the web page to finish
configuring
your machine.
If you are not using the setup wizard from another machine,
you
can finish configuring your machine by pointing a Web browser
on
another machine to the following URL:
${BOLD_WHITE}
http://$HOSTNAME/vmware-config${NORMAL}
If you want direct shell access to the ${BOLD_RED}Console
OS${NORMAL}, you may press
Alt-F2 to switch to a virtual terminal where you may log in.
For more information see the on-line documentation at
${BOLD_WHITE}${DOC_URL}${NORMAL}
EOF
}
# VMnix is running and the system has been configured but the
vmkernel
# is not loaded
show_stage3_page() {
cat <<EOF
$TITLE
Your system is configured properly, but the vmkernel has not
been
loaded yet. Until the vmkernel is loaded, you cannot run any
virtual machines.
You can load the vmkernel by typing the following command
from
the Console OS (Service Console) shell:
$ /etc/rc.d/init.d/vmware start
To get direct shell access to the ${BOLD_RED}Console OS${NORMAL},
you may press
Alt-F2 to switch to a virtual terminal where you may log in.
For more information see the on-line documentation at
${BOLD_WHITE}${DOC_URL}${NORMAL}
EOF
}
# VMnix is running and so is the vmkernel
show_done_page() {
cat <<EOF
$TITLE
Your system is configured properly and the vmkernel is
loaded.
To access the virtual machines on the system, please go to
another machine and point a Web browser to the following URL:
${BOLD_WHITE}
http://$HOSTNAME/${NORMAL}
To get direct shell access to the ${BOLD_RED}Console OS${NORMAL},
you may press
Alt-F2 to switch to a virtual terminal where you may log in.
For more information see the on-line documentation at
${BOLD_WHITE}${DOC_URL}${NORMAL}
EOF
}
is_vmnix() {
if uname -a | grep -q vmnix; then
return 0
else
return 1
fi
}
is_configured() {
local FILE=/etc/vmware/not_configured
if [ -e "$FILE" ]; then
return 1
else
return 0
fi
}
is_vmkernel() {
local DIR=/proc/vmware/filters
if [ -e "$DIR" ]; then
return 0
else
return 1
fi
}
is_user() {
if [ ! -z $USER ]; then
return 0
else
return 1
fi
}
# Redirect stdout and stderr to always be the tty that we have
set
# Otherwise, when the script does die, it is restarted and its
stdout
# is redirected to the virtual terminal that is currently
running.
if ! is_user; then
exec 0<$TTY
exec 1>$TTY
exec 2>$TTY
fi
# Ignore anything the user types
stty -echo
count=0
while [ "$count" -lt "$MAX_ITERATIONS" ]; do
clear
# Use longer/slower periods when we know state changes are
unlikely. Fast
# periods will poll more frequently exerting more load on the
system.
if ! is_vmnix; then
PERIOD=$SLOW_PERIOD
show_initial_page
else
if is_vmkernel; then
PERIOD=$SLOW_PERIOD
show_done_page
else
if ! is_configured; then
PERIOD=$FAST_PERIOD
show_stage2_page
else
PERIOD=$FAST_PERIOD
show_stage3_page
fi
fi
fi
if is_user; then
stty echo
exit 0
fi
sleep $PERIOD
count=`expr $count + 1`
done
stty echo
***************END SAMPLE vmkstatus file**************
Keywords
Attachments
Request a Product Feature
- Updated:
- Categories:
- Product Family:
- Product(s):
- Product Version(s):

