Advertisement
| Hall of Fame |
|
[x]
Posted via EE Mobile
|
||
Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again. |
||
| Question |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: |
#! /bin/bash
#
# Author: Andrew Grant
# Date: 12/06/2006
#
### BEGIN INIT INFO
# Provides: vmware-player
# Required-Start: $network VMware xdm
# Required-Stop: $network VMware
# Default-Start: 5
# Default-Stop: 0 1 2 6
# Description: Run a VMware machine as a service
### END INIT INFO
# Variable explanations:
# VMMachine = Friendly name of virtual machine
# VMDir = Directory path of Virtual Machine
# VMFile = Virtual Machine Configuration File (.vmx file)
# VMDisplay = Virtual Machine Display (start with 1)
# VMTerminal = Virtual Machine Terminal to use (start with 8)
# VMDns = DNS name assigned to the Virtual Machine
# VMShutdownTimer = Time to wait for VM shutdown (in seconds)
# 5 Minutes is normally more than adequate
#
# Each virtual machine must have its own X display and terminal.
# Assuming a standard installation that runs X on display 0 and
# vt7, your first virtual machine will use:
# X display 1 and vt 8
# The second:
# X Display 2 and vt 9
# and so on.
# Set this to what you need
VMMachine="tapeworm"
VMDir="/var/vmserver/Novell Open Enterprise Server"
VMFile="SUSE Linux Enterprise Server.vmx"
VMDisplay="1"
VMTerminal="8"
VMDnsName="tapeworm.ru.ac.za"
VMShutdownTimer="300"
# These shouldn't need to be changed
VMFullName="$VMDir/$VMFile"
VMBin="/usr/lib/vmware/bin/vmplayer"
PID_FILE="/var/run/vmware-$VMMachine.pid"
# Set paths
export PATH=/sbin:/usr/sbin:/usr/local/sbin:/root/bin:/usr/local/bin:/usr/bin:/usr/X11R6/bin:/bin:/opt/gnome/bin:/usr/lib/java/bin
. /etc/rc.status
rc_reset
case "$1" in
start)
echo -n "Starting Virtual Machine ${VMMachine}"
if [ ! -f "${VMFullName}" ]; then
echo -n >&2 "Virtual Machine not found, ${VMFile} does not exist. "
rc_status -s
exit 6
fi
checkproc -p ${PID_FILE} ${VMBin}
case "$?" in
0) echo "- Warning: daemon already running. " ;;
1) echo "- Warning: ${PID_FILE} exists. " ;;
esac
if [ -f "/tmp/.X${VMDisplay}-lock" ]; then
echo "Stale X lock for display ${VMDisplay} found, removing..."
rm "/tmp/.X${VMDisplay}-lock"
fi
startproc -p ${PID_FILE} /usr/X11R6/bin/xinit /usr/bin/vmplayer "${VMFullName}" -- :${VMDisplay} vt${VMTerminal} > /dev/null &
rc_status -v
;;
stop)
checkproc -p ${PID_FILE} ${VMBin}
VMStatus=${?}
case "$VMStatus" in
1)
echo "- Warning: Virtual Machine ${VMMachine} not running but ${PID_FILE} exists. "
exit 1
;;
3)
echo "- Warning: Virtual Machine ${VMMachine} not running. "
exit 1
;;
esac
echo -n "Shutting down Virtual Machine ${VMMachine} - this will take a moment..."
/usr/bin/ssh root@${VMDnsName} '/sbin/shutdown -h now'
if [ "$?" = 1 ] ; then
echo "- Warning: Unable to contact Virtual Machine ${VMMachine} "
exit 1
fi
timer=0
while [ $? != 3 ]
do
/bin/sleep 1
let timer=timer+1
if [ "$timer" = "$VMShutdownTimer" ] ; then
echo "- Warning: Shutdown of Virtual Machine ${VMMachine} failed (took too long)"
exit 1
fi
checkproc -p ${PID_FILE} ${VMBin}
done
echo "Shutdown of ${VMMachine} complete."
rc_status -v
;;
restart)
$0 stop
$0 start
rc_status
;;
status)
echo -n "Checking for Virtual Machine ${VMMachine}"
checkproc -p ${PID_FILE} ${VMBin}
rc_status -v
;;
*)
echo "Usage: $0 {start|stop|status|restart}"
exit 1
;;
esac
rc_exit
Once you have your script you need
|