Quota command not as documented?


I've created my own quota commands to set quota's on a sun 7110 storage. It seems this scripts isn't called with the arguments which are documented? Only the username is passed as argument to the script. The soft and hard quota are missing. I created to "echo $* >> /var/log/virtualminscripts.info" to verify only one argument is passed?

Is this a bug in the code, in the documentation, or in my script :)

Thanks Martijn


!/bin/ksh Command to set a user's quota When external quota commands are being used, the program set in this option will be called when Virtualmin wants to set the quotas for a Unix user. The parameters it is called with are : The Unix username The new soft quota in 1 kB blocks, or 0 for unlimited. The new hard quota in 1 kB blocks, or 0 for unlimited.

echo $* >> /var/log/virtualminscripts.info

echo $1 | grep "@" > /dev/null if [[ 0 -eq $? ]]; then USERNAME=$1 else
USERNAME=echo $1 | sed 's/-/@/' fi SHARENAME=${USERNAME##*@}

if [[ -z $2 ]]; then RESERVATION=0 else RESERVATION=echo "$2 * 1024" | bc fi if [[ -z $3 ]]; then QUOTA=0 else QUOTA=echo "$3 * 1024" | bc fi

if [[ $USERNAME = $SHARENAME ]]; then /opt/redknot/scripts/fishworks/set-quota.ksh -P Slow -p home -s $SHARENAME -q $QUOTA -r $RESERVATION else /opt/redknot/scripts/fishworks/set-userquota.ksh -P Slow -p home -s $SHARENAME -u $USERNAME -q $QUOTA fi



That's unusual, the code for calling that command looks OK..

If you enable full command logging at Webmin -> Webmin Configuration -> Logging -> Log changes made to files by each action, perform some action to set a user's quota, and then view that action at Webmin -> Webmin Actions Log , what does it show as the command that was run?


that showed me that it is also running set_group_quota.ksh with the quota parameters.


So it shows that the parameters are being passed, but your script is not seeing them in $* ?

What is the exact full command that is being run?

Executed command /opt/redknot/scripts/virtualmin/before_making_changes_to_server.ksh Executed command /opt/redknot/scripts/virtualmin/get_user_quota.ksh testserver1.nl Executed command /opt/redknot/scripts/virtualmin/before_making_changes_to_ldapuser.ksh Executed command /opt/redknot/scripts/virtualmin/after_making_changes_to_ldapuser.ksh Executed command /opt/redknot/scripts/virtualmin/set_user_quota.ksh testserver1.nl
Executed command /opt/redknot/scripts/virtualmin/set_group_quota.ksh testserver1.nl 2621440 2621440 Changed file /etc/webmin/virtual-server/domains/127928230012283 10c10

< plan=127805861116068

plan=127805869216129 63c63

< bw_limit=10737418240

bw_limit=32212254720 85c85

< quota=1048576

quota=2621440 120a121 pass_set=0 Sent signal USR1 to PID 24308 Executed command /opt/redknot/scripts/virtualmin/after_making_changes_to_server.ksh

Ok, I see the bug now .. if a user has no quota set (meaning unlimited), the quota parameters to set_user_quota.ksh will be empty instead of zero. I will fix this in the next Virtualmin release .. but until then, you could modify your script to treat $2 and $3 as 0 if they are empty.

Ok perfect!

How can I set the soft and hard quota for a virtual server? When I change an account plan I can only change 1 quota (is this the soft or the hard quota?).

Thanks, Martijn

You can't set the hard and soft quotas separately in Virtualmin - however, you can control if the quota it sets based on the UI is hard or soft.

Automatically closed -- issue fixed for 2 weeks with no activity.


How is the 'Disk usage and quota' on the 'Virtual Server Information' calculated? I see a number which I don't expect. I have created my own quota commands but when I log message virtualmin doesn't seem to use these script for this page, the scripts are used for the other pages and commands.

thanks, Martijn

Which page are you referring to exactly? There is no page titled "Virtual Server Information"