im using mysql accounts and i dont have a vpasswd, so i changed line 6 to: if [ -e ${VIRTUALROOT}/${domain}/.qmail-default ]; then (all my domains have a .qmail-default)
cream
Bill Gradwohl wrote:
Here's a start to what you might want. Your criteria is open to interpretation. I didn't bother prettying it up, and you can add any code you might want.
#!/bin/bash
VIRTUALROOT='/home/vpopmail/domains' cd ${VIRTUALROOT}
find . -type d -maxdepth 1 | sed 's#^\./##' | while read domain; do
if [ -e ${VIRTUALROOT}/${domain}/vpasswd ]; then
echo
echo Domain - ${domain} - occupies $(du -hs ${domain})
cd ${VIRTUALROOT}/${domain}
find . -type d -maxdepth 1 | sed 's#^\./##' | while read user; do
if [ -d ${VIRTUALROOT}/${domain}/${user}/Maildir ]; then
echo ${user}
echo " Maildir/new contains $(ls -1 ${user}/Maildir/new|wc -l) messages."
echo " Account occupies $(du -hs ${user})"
fi
done
cd -
fi
done