Disk quota values are different from the actual values
Symptoms
The value in the Disk field in user settings differs from the actual disk quotas.
Causes
- partition mount point was changed
- quotas were defined incorrectly during installation
Solution
Use one of the synchronization scripts below: a script will adjust the actual disk quota values in accordance with the values set in the panel.
The script option must be selected depending on the DBMS used by the panel. To check the DBMS type, run the following command:
mysql ispmgr
A successful connection to the database indicates that MySQL is used; an error message «Unknown database 'ispmgr'» indicates that SQLite3 is used.
Copy the corresponding script and save it to a separate file on the server. Then make it an executable file by running the command:
chmod +x PATH_TO_FILE/SCRIPT_NAME
The script will not work if it is run without administrator rights and if the DBMS administrator password in the file at /root/.my.cnf
differs from the actual one.
You can run the script using the command:
sh PATH_TO_FILE/SCRIPT_NAME
Script for MySQL
#!/bin/bash
mysql ispmgr -e "select users.name, userprops.value from users inner join userprops on id=userprops.users where userprops.name='limit_quota' AND value>0;" > test.txt
i=`wc -l test.txt | awk '{print $1}'` ;
for (( count=2; count<=$i; count++ ))
do
echo "$count";
pd="$count""p";
echo "$pd";
let "in=`cat test.txt | awk '{print $2}' | sed -n "$pd"`*1024/8";
setquota -g `cat test.txt | awk '{print $1}' | sed -n "$pd"` `cat test.txt | awk '{print $2}' | sed -n "$pd"`M `cat test.txt | awk '{print $2}' | sed -n "$pd"`M $in $in /;
done
rm -rf test.txt
Script for SQLite3
#!/bin/bash
sqlite3 /usr/local/mgr5/etc/ispmgr.db "select users.name, userprops.value from users inner join userprops on id=userprops.users where userprops.name='limit_quota' AND value>0;" > test.txt
i=`wc -l test.txt | awk '{print $1}'` ;
for (( count=1; count<=$i; count++ ))
do
echo "$count";
pd="$count""p";
echo "$pd";
let "in=`cat test.txt | awk -F "|" '{print $2}' | sed -n "$pd"`*1024/8";
setquota -g `cat test.txt | awk -F "|" '{print $1}' | sed -n "$pd"` `cat test.txt | awk -F "|" '{print $2}' | sed -n "$pd"`M `cat test.txt | awk -F "|" '{print $2}' | sed -n "$pd"`M $in $in /;
done
#rm -rf test.txt