Skip to content

Instantly share code, notes, and snippets.

@emmaly
Created February 5, 2018 18:37
Show Gist options
  • Select an option

  • Save emmaly/0715841f703c8eabb5c4b26248e9d73d to your computer and use it in GitHub Desktop.

Select an option

Save emmaly/0715841f703c8eabb5c4b26248e9d73d to your computer and use it in GitHub Desktop.
OpenVZ helpers
# cd into a container on the host-side, optionally including a subdir within it
function xcd() {
VEID="$(vzlist "$1" | grep -v CTID | tr -s ' ' | cut -d' ' -f2)"
shift
[ -z "$VEID" ] && exit 1
cd /var/lib/vz/private/$VEID$*
}
# helps to shut down and disable containers
function xct() {
VEID="$(vzlist "$1" | grep -v CTID | tr -s ' ' | cut -d' ' -f2)"
[ -z "$VEID" ] && exit 1
sudo vzctl stop $VEID
sudo vzctl set $VEID --save --onboot=no
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment