Skip to content

Instantly share code, notes, and snippets.

@sergey-dryabzhinsky
Last active May 27, 2016 07:29
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 sergey-dryabzhinsky/e3f5a64589f1a39b8dabb0dc10dbba4e to your computer and use it in GitHub Desktop.
Save sergey-dryabzhinsky/e3f5a64589f1a39b8dabb0dc10dbba4e to your computer and use it in GitHub Desktop.
OpenVZ container umount script with space quoting
#!/bin/bash
###
# More advanced on-umount script for OpenVZ container
# Based on https://openvz.org/Bind_mounts
#
# 1. Set quotas off
#
[ -f /etc/vz/vz.conf ] || exit 1
[ -f $VE_CONFFILE ] || exit 1
. /etc/vz/vz.conf
. ${VE_CONFFILE}
# Do not need quotas? Then uncomment:
#exit 0
# Quota ID, make it real BIG number, to avoid crossing with container root VEID
QID=$((VEID+1000000))
vzquota show $QID >/dev/null 2>/dev/null
if [ $? -ne 0 ]; then
# Quotas OFF
vzquota off $QID
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment