diff options
author | Jan Kara <jack@suse.cz> | 2010-09-14 21:28:11 +0200 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2010-09-14 21:31:07 +0200 |
commit | 4ae56e1b19e043ea12f01a60d25d0a932d2e73da (patch) | |
tree | d7b65454bc986145507504e22a1bee1721c5b9ee /quota-nfs.sh | |
parent | c7cfb6e73bb8e73e6dcf857b5ecf374679a778ab (diff) |
Create quota-nfs.sh for systems with automounted nfs homes
Added a script to generate more user friendly output when quota(1)
is used on systems with home directories on NFS where each user has
his home mounted separately but from the same remote filesystem.
Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'quota-nfs.sh')
-rwxr-xr-x | quota-nfs.sh | 28 |
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 |