fix quota

This commit is contained in:
2021-12-18 13:02:49 +01:00
parent 81fc921e3f
commit 868d131972
3 changed files with 14 additions and 5 deletions

1
.gitignore vendored
View File

@@ -1,3 +1,4 @@
.htaccess .htaccess
.htpasswd .htpasswd
config.cfg config.cfg
quota

View File

@@ -25,9 +25,17 @@ It's recommended to install UAAP automatically by using another script of mine,
### Manual method (not recommended, needs more work) ### Manual method (not recommended, needs more work)
Download the git repository by using Download the git repository by using
`git clone http://src.mehl.mx/git/uberspace-setup.git` `git clone http://src.mehl.mx/git/uberspace-webadmin.git`
I assume it's best to place these files in a subdomain. I used `panel.example.com` for that. I assume it's best to place these files in a subdomain. I used `panel.example.com` for that.
Now open the files `config.cfg.sample`, `.htaccess.sample`, and `.htpasswd.sample` and change all necessary settings. Be sure to remove the `.sample` in the file names of these files afterwards. Now open the files `config.cfg.sample`, `.htaccess.sample`, and `.htpasswd.sample` and change all necessary settings. Be sure to remove the `.sample` in the file names of these files afterwards.
### Other steps
On Uberspace 7, you'll need to create a cronjob to provide quota information because of SELinux limitations. To do so, edit your crontab with `crontab -e` and insert:
```
* * * * * quota -gsl > /var/www/virtual/MYUSERNAME/panel.example.com/quota
```

View File

@@ -347,8 +347,8 @@ if [ "$ACTION" == "quota" ]; then
echo "Calculating account disk usage..." echo "Calculating account disk usage..."
echo echo
USAGE=$(quota -gsl | tail -n 1 | awk -F" " '{ print $2 }' | sed 's/[A-Za-z]//g') USAGE=$(cat quota | tail -n 1 | awk -F" " '{ print $2 }')
QUOTA=$(quota -gsl | tail -n 1 | awk -F" " '{ print $3 }' | sed 's/[A-Za-z]//g') QUOTA=$(cat quota | tail -n 1 | awk -F" " '{ print $3 }' | sed 's/[A-Za-z]//g')
# If smaller than 1M, set usage to 1M to avoid miscalcuations # If smaller than 1M, set usage to 1M to avoid miscalcuations
if ! echo $USAGE | grep -q "[A-Za-z]$"; then if ! echo $USAGE | grep -q "[A-Za-z]$"; then
@@ -364,7 +364,7 @@ if [ "$ACTION" == "quota" ]; then
PERC=$(echo "scale=2; 100 - $PERC" | bc) PERC=$(echo "scale=2; 100 - $PERC" | bc)
echo "You have "$[$QUOTA - $USAGE]" MB free ($PERC %)." echo "You have "$(($QUOTA - $USAGE))" MB free ($PERC %)."
fi # /quota fi # /quota