summaryrefslogtreecommitdiff
path: root/quota-nfs.sh
blob: de4334e6ebed58e94203fd99030cd2842dabb622 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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