| Revision 2862,
1.2 KB
checked in by fufroma, 2 years ago
(diff) |
|
Ajout d'un "patch" pour quand on a pas activé les quota sur le disque.
|
-
Property svn:executable set to
*
|
| Line | |
|---|
| 1 | #!/bin/bash |
|---|
| 2 | . /etc/alternc/local.sh |
|---|
| 3 | |
|---|
| 4 | AWK=/usr/bin/awk |
|---|
| 5 | DF=/bin/df |
|---|
| 6 | SED=/bin/sed |
|---|
| 7 | MOUNT=/bin/mount |
|---|
| 8 | QUOTA=/usr/bin/quota |
|---|
| 9 | GREP=/bin/grep |
|---|
| 10 | WC=/usr/bin/wc |
|---|
| 11 | |
|---|
| 12 | DATA_PART=`$DF ${ALTERNC_LOC} 2>/dev/null | $AWK '/^\// { print $1 }'` |
|---|
| 13 | |
|---|
| 14 | # quota will give over NFS will print the partition using the full NFS name |
|---|
| 15 | # (e.g. 10.0.0.1:/var/alternc) so we need to lookup first with mount |
|---|
| 16 | # to convert DATA_PART if needed. |
|---|
| 17 | QUOTA_PART=`$MOUNT | $SED -n -e "s,\([^ ]*\) on ${DATA_PART} type nfs.*,\1,p"` |
|---|
| 18 | if [ -z "$QUOTA_PART" ]; then |
|---|
| 19 | QUOTA_PART="$DATA_PART" |
|---|
| 20 | fi |
|---|
| 21 | |
|---|
| 22 | # quota will split its display on two lines if QUOTA_PART is bigger than 15 |
|---|
| 23 | # characters. *sigh* |
|---|
| 24 | PART_LEN=`echo -n "$QUOTA_PART" | $WC -c` |
|---|
| 25 | val=$( |
|---|
| 26 | if [ "$PART_LEN" -gt 15 ]; then |
|---|
| 27 | $QUOTA -g "$1" | |
|---|
| 28 | $SED -n -e "\\;${QUOTA_PART};,+1s/ *\([0-9]*\) .*/\1/p" | |
|---|
| 29 | $GREP -v '^$' |
|---|
| 30 | $QUOTA -g "$1" | |
|---|
| 31 | $SED -n -e "\\;${QUOTA_PART};,+1s/ *[0-9]* *\([0-9]*\) .*/\1/p" | |
|---|
| 32 | $GREP -v '^$' |
|---|
| 33 | else |
|---|
| 34 | $QUOTA -g "$1" | $AWK /${QUOTA_PART//\//\\\/}/\ {print\ '$2'} |
|---|
| 35 | $QUOTA -g "$1" | $AWK /${QUOTA_PART//\//\\\/}/\ {print\ '$3'} |
|---|
| 36 | fi |
|---|
| 37 | ) |
|---|
| 38 | |
|---|
| 39 | # If the quota aren't activated, I return something anyway |
|---|
| 40 | if [ -z "$val" ] ; then |
|---|
| 41 | echo 0 |
|---|
| 42 | echo 0 |
|---|
| 43 | else |
|---|
| 44 | echo -e "$val" |
|---|
| 45 | fi |
|---|
| 46 | |
|---|
Note: See
TracBrowser
for help on using the repository browser.