setquota.sh - Set Directory Quotas on NSS with OES2 Linux

0 Likes

I wrote a short script to set directory quotas for lots of directories. It uses the metamig utility and dynamically creates the needed xml file.



Usage:


Simply add the basepath and the quotasize as parameters:



eg:



 ./setquota.sh  /media/nss/DAT/user/homedirs  1024000 


After listing all affected dirs, you have to confirm the job.


Now the quotas for all directories in the basepath (not in further subdirs) will be set.



After that you can optional save the xml file for executing the job later.



Hint:



  • the quota size is in KB

  • you have to enable Directory Quotas for this volume in nssmu or iManager



Hope that helps somebody!

Tobi



Labels:

Collateral
How To-Best Practice
Comment List
Parents
  • Thanks, it works fine.
    I only made one change, I added a line after line 38:
    38 echo "Size is ok"
    39 sizeinbyte=$((${2}*1024))
    and changed the quotaAmount in line 71:
    from ${2}000 to ${sizeinbyte}
    so that the quota-size is really in KB and not in 1000 Bytes. If you want to use MB, you only have to change line 39: sizeinbyte=$((${2}*1024*1024))
    With JRB-Utils setquota it took round about 10 Seconds per user to set the quota over a WAN-Line, with this script the quotas of 1000 Users are set in 10 seconds!!!
Comment
  • Thanks, it works fine.
    I only made one change, I added a line after line 38:
    38 echo "Size is ok"
    39 sizeinbyte=$((${2}*1024))
    and changed the quotaAmount in line 71:
    from ${2}000 to ${sizeinbyte}
    so that the quota-size is really in KB and not in 1000 Bytes. If you want to use MB, you only have to change line 39: sizeinbyte=$((${2}*1024*1024))
    With JRB-Utils setquota it took round about 10 Seconds per user to set the quota over a WAN-Line, with this script the quotas of 1000 Users are set in 10 seconds!!!
Children
No Data
Related
Recommended