I want to do the following: Run a program (qmHandle) that shows me what my mail queue looks like. I want to send the resulting text to myself via e-mail, and run this all via a cron job several times a day. I'm running qmail - but I should be able to translate any sendmail commands easily. I just found 2000 spams going out through my server and stopped it, found a vulnerability, and capped it off, but then again you never know. I'd like to monitor the queue pretty regularly over the next week to see if anything else is going out.
A good tutorial on bash scripting: http://www.tldp.org/LDP/abs/html/ . Don't be put off by the "Advanced" title, it covers basics through to advanced.
If you want a quick fix, all you need is probably something like: qmHandle | mail -s "Mail queue report" your@email.com Code (markup): Presuming qmHandle prints to StdOut in non-interactive mode Add the above to your crontab. I posted the basics on using cron a while back.
excellent. Much easier than I thought: In my crontab: 05 * * * * cd /path/to/qmhandle; ./qmHandle -R |/var/qmail/bin/qmail-inject myemail@dress Code (markup): I didn't have "mail" available, so I man'ned qmail inject and it was just as easy for syntax. I thought it would have been much harder...