Skip to content

Instantly share code, notes, and snippets.

@cvrolf
Last active November 2, 2017 11:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cvrolf/38102e1e2d67caf3952b09e0aa478885 to your computer and use it in GitHub Desktop.
Save cvrolf/38102e1e2d67caf3952b09e0aa478885 to your computer and use it in GitHub Desktop.
#@RunAs: Open a Terminal with user root @ Master Machine*****
###
### Bash Shell behavior
# @doc -e Exit immediately if a command returns a non-zero status.
# @doc -u Treat unset variables and parameters other than the special parameters ‘@’ or ‘*’ as an error when performing parameter expansion.
# @doc -x Print a trace of commands after they are expanded and before they are executed.
set -u
set -x
###
### Global vars
MYDOMAIN="myvmtest"
MYIPADDRESS=192.168.122.102
MYMACADDRESS=52:54:00:ff:ff:66
###
### Check you are on the correct host: Host Machine (not the VM)
hostname
whoami
if [ "`hostname`" == "${MYDOMAIN}" ]; then
echo "ABORT. This is not a session on the Host Machine"
sleep 10
exit 1
else
echo "OK. This is a session on the Host Machine"
fi
###
### REBOOT VM
virsh list --all
virsh reboot --domain ${MYDOMAIN}
sleep 10
virsh list --all
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment