summaryrefslogtreecommitdiff
path: root/quota-nfs.sh
diff options
context:
space:
mode:
authorOssama Othman <ossama.othman@intel.com>2013-11-25 15:00:02 -0800
committerOssama Othman <ossama.othman@intel.com>2013-11-25 15:00:02 -0800
commit47ae1cde69cd6bf2c22e20902cefa3f0e25c8cb4 (patch)
treeadd9aa20a19f410a91522d4b95df3e93c57f8637 /quota-nfs.sh
parent8c82de96cd23e4823a2d29eb2de2295c0866b0c9 (diff)
downloadquota-upstream.tar.gz
quota-upstream.tar.bz2
quota-upstream.zip
Update to latest version of quota.4.01upstream
Change-Id: I2271f01ae7877d43dde2432a45b49b910ddb6f8f Signed-off-by: Ossama Othman <ossama.othman@intel.com>
Diffstat (limited to 'quota-nfs.sh')
-rwxr-xr-xquota-nfs.sh28
1 files changed, 28 insertions, 0 deletions
diff --git a/quota-nfs.sh b/quota-nfs.sh
new file mode 100755
index 0000000..de4334e
--- /dev/null
+++ b/quota-nfs.sh
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+# This is a script which generates more user friendly output of quota(1)
+# command for systems with NFS-mounted home directories.
+#
+# In the simplest case it is enough to edit BASEDIR to point to a directory
+# under which home directories are mounted. In more complicated cases,
+# updating the shell matching code should be simple enough.
+#
+# Note that you can use also device name (NFS export in case of NFS mount
+# point) for your matching.
+
+BASEDIR="/home"
+
+DIRS=`quota -A -Q -v --show-mntpoint --no-wrap |
+sed -n -e '3,$p' |
+cut -d ' ' -f 1,2 |
+while read DEVICE DIR; do
+ case $DIR in
+ $BASEDIR/$LOGNAME) echo -n "$DIR " ;;
+ $BASEDIR/*) ;;
+ *) echo -n "$DIR " ;;
+ esac
+done`
+
+if [ -n "$DIRS" ]; then
+ quota $@ -f $DIRS
+fi