Changeset 1744
- Timestamp:
- 11/28/06 01:49:12 (2 years ago)
- Files:
-
- alternc/trunk/src/quota_get.sh (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
alternc/trunk/src/quota_get.sh
r891 r1744 2 2 . /etc/alternc/local.sh 3 3 4 DATA_PART=`df ${ALTERNC_LOC} 2>/dev/null | awk '/^\// { print $1 }'` 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 11 DATA_PART=`$DF ${ALTERNC_LOC} 2>/dev/null | $AWK '/^\// { print $1 }'` 5 12 6 13 # quota will give over NFS will print the partition using the full NFS name 7 14 # (e.g. 10.0.0.1:/var/alternc) so we need to lookup first with mount 8 15 # to convert DATA_PART if needed. 9 QUOTA_PART=` mount | sed-n -e "s,\([^ ]*\) on ${DATA_PART} type nfs.*,\1,p"`16 QUOTA_PART=`$MOUNT | $SED -n -e "s,\([^ ]*\) on ${DATA_PART} type nfs.*,\1,p"` 10 17 if [ -z "$QUOTA_PART" ]; then 11 18 QUOTA_PART="$DATA_PART" … … 16 23 PART_LEN=`echo -n "$QUOTA_PART" | wc -c` 17 24 if [ "$PART_LEN" -gt 15 ]; then 18 quota-g "$1" |19 sed-n -e "\\;${QUOTA_PART};,+1s/ *\([0-9]*\) .*/\1/p" |20 grep-v '^$'21 quota-g "$1" |22 sed-n -e "\\;${QUOTA_PART};,+1s/ *[0-9]* *\([0-9]*\) .*/\1/p" |23 grep-v '^$'25 $QUOTA -g "$1" | 26 $SED -n -e "\\;${QUOTA_PART};,+1s/ *\([0-9]*\) .*/\1/p" | 27 $GREP -v '^$' 28 $QUOTA -g "$1" | 29 $SED -n -e "\\;${QUOTA_PART};,+1s/ *[0-9]* *\([0-9]*\) .*/\1/p" | 30 $GREP -v '^$' 24 31 else 25 quota -g "$1" | awk/${QUOTA_PART//\//\\\/}/\ {print\ '$2'}26 quota -g "$1" | awk/${QUOTA_PART//\//\\\/}/\ {print\ '$3'}32 $QUOTA -g "$1" | $AWK /${QUOTA_PART//\//\\\/}/\ {print\ '$2'} 33 $QUOTA -g "$1" | $AWK /${QUOTA_PART//\//\\\/}/\ {print\ '$3'} 27 34 fi 28 35
