Re: [vchkpw] reporting on my vpopmail system
Rick Root wrote: Does anyone have a script or application or something that will view my vpopmail directory structure and give me a report? I would like to know. accounts in each domain # of messages per account amount of disk space per account amount of disk space per domain Thanks. - Rick This might help... works also with mysql domain since use vpopbull for listing user. "vpopmailstats user|sort -nr" tell you who is eating too much space :-) [EMAIL PROTECTED]:~# cat vpopmailstats #!/bin/bash if [ $# -lt 1 ] then echo "Usage: $0 user|domain [human]" exit 1 else if [ $# -ge 2 ] && [ $2 = "human" ] then DUOPT="-sh" else DUOPT="-s" fi VIRTUALHOME='/home/vpopmail/' VIRTUALBIN=$VIRTUALHOME'bin' VIRTUALUSER=`$VIRTUALBIN/vpopbull -V -n 2>/dev/null` VIRTUALUSERDIR=`for i in $VIRTUALUSER ; do /home/vpopmail/bin/vuserinfo -d "$i"; done` VIRTUALDOMAINDIR=`$VIRTUALBIN/vdominfo -d|grep -v ^Note|sort|uniq` case "$1" in user) for l in $VIRTUALUSERDIR; do \ echo -n "`du $DUOPT $l|awk '{print $1}'` bytes used in " echo "`ls $l/Maildir/new|wc -l`/`ls $l/Maildir/cur|wc -l` New/Cur msg, by user dir: $l" done ;; domain) for m in $VIRTUALDOMAINDIR; do \ echo "`du $DUOPT $m|awk '{print $1}'` bytes used by domain dir: $m" done ;; *) echo "Usage: $0 user|domain all|top" ;; esac fi
Re: [vchkpw] reporting on my vpopmail system
Bill Gradwohl wrote: I've written some perl scripts, but I have to crack the book every time I've been writing perl scripts on and off since 1996, and I still can't remember the syntax for substr() =) I suggest you post yours to the list as its a better base for people to use to expand on it for their own unique requirements. That's what I'm going to do, now that you've done most of the hard work. :-) Thanks! I did... and so did you! - Rick
Re: [vchkpw] reporting on my vpopmail system
Rick Root wrote: Bill, thanks for that script! One problem is that I have more htan 100 domains, and in several cases, more than 100 users per domain... so I was inspired to write a script in perl that parses the output of "vdominfo" to retrieve the directory of each domain... and then parses each vpasswd file for user account directory information. It generates a CSV for me. http://www.webworksllc.com/vpopmailReport.txt - Rick You're welcome. We are all creatures of habit. I wrote batch file scripts for the DOS/Windows world for so long that moving to bash was the natural thing to do. As Maslow once said, "When the only tool you have is a hammer, everything starts looking like a nail". I've written some perl scripts, but I have to crack the book every time for the syntax. When you requested a script and I knew I wanted something similar, I just started coding in bash. Your solutions is more specific to vpopmail and hence a better solution. Even if you have non standard directory locations, yours will work whereas mine won't. I suggest you post yours to the list as its a better base for people to use to expand on it for their own unique requirements. That's what I'm going to do, now that you've done most of the hard work. :-) Thanks! -- Bill Gradwohl [EMAIL PROTECTED] http://www.ycc.com spamSTOMPER Protected email
RE: [vchkpw] reporting on my vpopmail system
-Original Message- From: Bill Gradwohl [mailto:[EMAIL PROTECTED] Sent: Thursday, October 21, 2004 11:53 AM To: [EMAIL PROTECTED] Subject: Re: [vchkpw] reporting on my vpopmail system Rick Root wrote: > Hello. (echo, echo!) is anyone out there? > > Rick Root wrote: > >> Does anyone have a script or application or something that will view >> my vpopmail directory structure and give me a report? >> >> I would like to know. >> >> accounts in each domain >> # of messages per account >> amount of disk space per account >> amount of disk space per domain >> >> Thanks. >> >> - Rick >> > > 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 -- Bill Gradwohl [EMAIL PROTECTED] http://www.ycc.com SPAMstomper Protected email Thank you for this script also Bill! =)
Re: [vchkpw] reporting on my vpopmail system
Bill, thanks for that script! One problem is that I have more htan 100 domains, and in several cases, more than 100 users per domain... so I was inspired to write a script in perl that parses the output of "vdominfo" to retrieve the directory of each domain... and then parses each vpasswd file for user account directory information. It generates a CSV for me. http://www.webworksllc.com/vpopmailReport.txt - Rick
Re: [vchkpw] reporting on my vpopmail system
Bill Gradwohl schrieb: Rick Root wrote: Hello. (echo, echo!) is anyone out there? Rick Root wrote: Does anyone have a script or application or something that will view my vpopmail directory structure and give me a report? I would like to know. accounts in each domain # of messages per account amount of disk space per account amount of disk space per domain Thanks. - Rick 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 thank you very much bill! werner
Re: [vchkpw] reporting on my vpopmail system
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
Re: [vchkpw] reporting on my vpopmail system
Rick Root wrote: Hello. (echo, echo!) is anyone out there? Rick Root wrote: Does anyone have a script or application or something that will view my vpopmail directory structure and give me a report? I would like to know. accounts in each domain # of messages per account amount of disk space per account amount of disk space per domain Thanks. - Rick 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 -- Bill Gradwohl [EMAIL PROTECTED] http://www.ycc.com SPAMstomper Protected email
Re: [vchkpw] reporting on my vpopmail system
Rick Root wrote: Hello. (echo, echo!) is anyone out there? Rick Root wrote: Does anyone have a script or application or something that will view my vpopmail directory structure and give me a report? I would like to know. accounts in each domain # of messages per account amount of disk space per account amount of disk space per domain Hi, We are here, I just guess no one has a script that does that. Regards, Rick
Re: [vchkpw] reporting on my vpopmail system
Hello. (echo, echo!) is anyone out there? Rick Root wrote: Does anyone have a script or application or something that will view my vpopmail directory structure and give me a report? I would like to know. accounts in each domain # of messages per account amount of disk space per account amount of disk space per domain Thanks. - Rick
[vchkpw] reporting on my vpopmail system
Does anyone have a script or application or something that will view my vpopmail directory structure and give me a report? I would like to know. accounts in each domain # of messages per account amount of disk space per account amount of disk space per domain Thanks. - Rick