#!/bin/bash
if ! mountpoint -q /www; then
    echo "/www not a mountpoint" >&2
    exit 1
fi
cd /www

for d in *; do
    if [[ $d == lost+found ]]; then continue; fi
    if [[ $d == aquota.user ]]; then continue; fi
    if [[ $d == _admin ]]; then continue; fi
    if mountpoint -q $d; then
        (date; df -mP $d) > $d/disk_usage.txt
    else
        Q=$(quota -u www-$d 2>/dev/null)
        if [[ $? == 0 ]]; then
            (date; echo "$Q") > $d/disk_usage.txt
        fi
    fi
done
# vim: set tabstop=4 shiftwidth=4 expandtab smarttab:
