Alternc  latest
Alternc logiel libre pour l'hébergement
quota_get_all
Go to the documentation of this file.
1 #!/bin/bash
2 # List quotas of all users in 3 columns :
3 # id used quota
4 
5 source /etc/alternc/local.sh
6 
7 #checking if quotas are installed
8 command -v /usr/sbin/repquota >/dev/null || { echo "Quotas uninstalled"; exit 0; }
9 
10 get_quota() {
11  quotadir="$1"
12  if [ "$quotadir" = "/" ] ; then
13  sudo repquota -g -v -n -p "$quotadir" 2>/dev/null || (echo "Error: can't get quota"; exit 1)
14  else
15  sudo repquota -g -v -n -p "$quotadir" 2>/dev/null || get_quota "$(dirname $quotadir)"
16  fi
17 }
18 
19 # Some help : this is what we must parse
20 # Block limits File limits
21 #Group used soft hard grace used soft hard grace
22 #----------------------------------------------------------------------
23 #root -- 1612116 0 0 96181 0 0
24 #adm -- 14532 0 0 226 0 0
25 
26 get_quota "$ALTERNC_HTML" | egrep "^\#[0-9]+"|while read gid blank bused bsoft bhard bgrace fused fsoft fhard fgrace ; do
27  echo ${gid/\#/} $bused $bhard
28 done
29