Changes

Jump to: navigation, search

Automatically setting quotaugidlimit

1,410 bytes added, 22:47, 12 February 2013
no edit summary
Place holder If you are using second-level user/group quota for user MaddinXx your containers, you have to take care that the value at every moment is high enough. Otherwise, newly created users and groups within the VE won't be able to own files. Rather than checking these values from time to share their time by hand, you can use the shell scriptfrom below to automatically set the quotaugidlimit based on the needs of the individual containers. Just setup a cronjob for it. <h2>Script</h2> <pre>#!/bin/bash # If one of these files does not exist then something# is really broken[ -d /etc/vz/conf ] || exit 1 # get all configured VEsFILES=/etc/vz/conf/*.conf # loop through all VEsfor file in $FILESdo # source the config file . $file  # check if quotaugidlimit is set if grep -q "QUOTAUGIDLIMIT" $file then # get current quotaugidlimit STRING=`grep "QUOTAUGIDLIMIT" $file` VALUE=${STRING##*QUOTAUGIDLIMIT=\"} INT=${VALUE%?}  # check if quotaugidlimit is > 0 if [ $INT != 0 ]; then # get configfile name CONFFILE=`basename $file` VEID=${CONFFILE%.*}  # run commands "inside" the VE USERC=`cat $VE_PRIVATE$VEID/etc/passwd | wc -l` GROUPC=`cat $VE_PRIVATE$VEID/etc/group | wc -l` TOTAL=$(($USERC + $GROUPC + 15))  # set the new quotaugidlimit for container vzctl set $VEID --quotaugidlimit $TOTAL --save fi fidone</pre> This will check for current users/groups count and increate the value by 15 - and set it as a new limit for the container.
8
edits

Navigation menu