Advertisement
Guest User

pause/unpause/check vm in ESXi

a guest
Jun 10th, 2013
227
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.59 KB | None
  1.      pausevm() (for vm in "$@"; do pid=`esxcli vm process list | grep -A 3 "^$vm$" | tail -n 1 | sed 's/.*: //'`; [ -n "$pid" ] && kill -STOP $pid || echo "$vm not found"; done)
  2.    unpausevm() (for vm in "$@"; do pid=`esxcli vm process list | grep -A 3 "^$vm$" | tail -n 1 | sed 's/.*: //'`; [ -n "$pid" ] && kill -CONT $pid || echo "$vm not found"; done)
  3. checkpausevm() (for vm in "$@"; do pid=`esxcli vm process list | grep -A 3 "^$vm$" | tail -n 1 | sed 's/.*: //'`; [ -n "$pid" ] && (ps -Ccs | grep -q "^$pid.*USIG" && echo "$vm is paused" || echo "$vm is running") || echo "$vm not found"; done)
Advertisement
RAW Paste Data Copied
Advertisement