root/alternc/branches/larpoux-unstable/src/quota_get.sh

Revision 828, 0.9 kB (checked in by joe, 3 years ago)

Les scripts sont maintenant éxécutables (avec svn:executable).

  • Property svn:executable set to *
Line 
1 #!/bin/sh
2 . /etc/alternc/local.sh
3
4 DATA_PART=`df ${ALTERNC_LOC} 2>/dev/null | awk '/^\// { print $1 }'`
5
6 # quota will give over NFS will print the partition using the full NFS name
7 # (e.g. 10.0.0.1:/var/alternc) so we need to lookup first with mount
8 # to convert DATA_PART if needed.
9 QUOTA_PART=`mount | sed -n -e "s,\([^ ]*\) on ${DATA_PART} type nfs.*,\1,p"`
10 if [ -z "$QUOTA_PART" ]; then
11     QUOTA_PART="$DATA_PART"
12 fi
13
14 # quota will split its display on two lines if QUOTA_PART is bigger than 15
15 # characters. *sigh*
16 PART_LEN=`echo -n "$QUOTA_PART" | wc -c`
17 if [ "$PART_LEN" -gt 15 ]; then
18     quota -g "$1" |
19        sed -n -e "\\;${QUOTA_PART}w,+1s/ *\([0-9]*\).*/\1/p"
20     quota -g "$1" |
21        sed -n -e "\\;${QUOTA_PART}w,+1s/ *[0-9]* *\([0-9]*\).*/\1/p"
22 else
23     quota -g "$1" | awk /${QUOTA_PART//\//\\\/}/\ {print\ '$2'}
24     quota -g "$1" | awk /${QUOTA_PART//\//\\\/}/\ {print\ '$3'}
25 fi
26
Note: See TracBrowser for help on using the browser.