Hi,
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
Comments
Submitted by JamieCameron on Fri, 07/16/2010 - 20:26 Comment #1
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?
Submitted by RedKnot on Mon, 07/19/2010 - 04:40 Comment #2
Thanks,
that showed me that it is also running set_group_quota.ksh with the quota parameters.
Martijn
Submitted by JamieCameron on Mon, 07/19/2010 - 06:06 Comment #3
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?
Submitted by RedKnot on Mon, 07/19/2010 - 06:12 Comment #4
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
< bw_limit=10737418240
< quota=1048576
Submitted by JamieCameron on Mon, 07/19/2010 - 10:45 Comment #5
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.
Submitted by RedKnot on Tue, 07/20/2010 - 03:54 Comment #6
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
Submitted by JamieCameron on Tue, 07/20/2010 - 06:40 Comment #7
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.
Submitted by Issues on Tue, 08/03/2010 - 07:20 Comment #8
Automatically closed -- issue fixed for 2 weeks with no activity.
Submitted by RedKnot on Tue, 09/14/2010 - 15:34 Comment #9
Hi,
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
Submitted by JamieCameron on Tue, 09/14/2010 - 17:00 Comment #10
Which page are you referring to exactly? There is no page titled "Virtual Server Information"