Changeset 717


Ignore:
Timestamp:
02/22/06 03:08:07 (7 years ago)
Author:
anarcat
Message:

[project @ Add quota support for NFS partitions]
To set quota it was just adding the -r option to setquota (use RPC).
To get quota, things complicate a bit :

  1. quota give us the full NFS path (e.g. 10.0.0.1:/nfs)
  2. quota splits its output on two lines if partition name has more than 15 characters

Please note that you have to add to put

RPCRQUOTADOPTS="--setquota"

in /etc/default/quota on the NFS server to allow remote quota setting.

Original author: lunar@…
Date: 2005-09-01 23:21:41

Location:
src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/quota_edit.sh

    r6 r717  
    11#!/bin/sh 
    22. /etc/alternc/local.sh 
    3 /usr/sbin/setquota -g $1 $2 $2 0 0 $DATA_PART 
     3/usr/sbin/setquota -r -g $1 $2 $2 0 0 $DATA_PART 
  • src/quota_get.sh

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