Last active
September 12, 2021 21:00
-
-
Save einarnn/793ad6f0cb2da3365911f0ba18c3ae45 to your computer and use it in GitHub Desktop.
Add Serial Port To VM
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# | |
# simple function to check for existence of a binary on the current | |
# path | |
# | |
checkExists() { | |
bin=`command -v $1` | |
if [ -z "$bin" ] | |
then | |
echo this script requires $1 to be on your path | |
exit 1 | |
fi | |
} | |
# we need govc to do this | |
checkExists govc | |
# parameters for govc | |
GOVC_URL=vcenter.fq.dn | |
GOVC_USERNAME=some_user | |
GOVC_PASSWORD='password' | |
GOVC_INSECURE=true | |
GOVC_NETWORK="VM Network" | |
GOVC_DATACENTER=some_datacenter | |
# take first parameter | |
VM=$1 | |
PORT=$2 | |
# simplistically add serial port for debugging | |
govc device.serial.add \ | |
-vm=${VM} | |
govc device.serial.connect \ | |
-vm=${VM} \ | |
-client=false \ | |
telnet://:${PORT} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment