Difference between revisions of "Qmail notes"

From Noah.org
Jump to navigationJump to search
Line 2: Line 2:
 
[[Category:qmail]]
 
[[Category:qmail]]
 
This is for a Qmailrocks install. This may not work on other qmail installations.
 
This is for a Qmailrocks install. This may not work on other qmail installations.
Or it may work. Or it may screwup up your mail queue or your whole installation or your whole machine or  
+
Or it may work. Or it may screwup up your mail queue; or your whole installation; or your whole machine;
your friend's machines. That is the beauty of qmail.
+
or your friend's machines. That is the beauty of qmail.
 
 
  
 
== mail.sh ==
 
== mail.sh ==

Revision as of 14:25, 5 February 2007

This is for a Qmailrocks install. This may not work on other qmail installations. Or it may work. Or it may screwup up your mail queue; or your whole installation; or your whole machine; or your friend's machines. That is the beauty of qmail.

mail.sh

This is the missing mail control script. It's crude, but it works. Note that this won't fix queue problems. Look for the qfixq script.

Note the "spamon" and "spamoff" commands. These are useful for turning just spam/virus filtering off. Sometimes spamassassin or clamav get messed up and it is preferable to get mail back online without spamfiltering while you try to figure out the problem.

#! /bin/sh
# Start or stop all mail services.
# Intended for a standard Qmail Rocks installation.
# Noah

case $1 in
status)
    /etc/init.d/clamd status
    /etc/init.d/spamassassin status
    /etc/init.d/imap status
    /etc/init.d/imaps status
    # Wish I could do "/usr/local/sbin/authdaemond status"
    ps auxww | grep authdaemond | grep -v "grep authdaemond"
    ps auxww | grep readproctitle | grep -v "grep readproctitle"
    /usr/bin/qmailctl stat
    ;;
spamon)
    cp /var/qmail/supervise/qmail-smtpd/run /var/qmail/supervise/qmail-smtpd/run.backup
    sed -i -e "s/^#QMAILQUEUE=.*/QMAILQUEUE=\"\/var\/qmail\/bin\/qmail-scanner-queue.pl\" ; export QMAILQUEUE/g" /var/qmail/supervise/qmail-smtpd/run
    ;;
spamoff)
    cp /var/qmail/supervise/qmail-smtpd/run /var/qmail/supervise/qmail-smtpd/run.backup
    sed -i -e "s/^QMAILQUEUE=.*/#QMAILQUEUE=\"\/var\/qmail\/bin\/qmail-scanner-queue.pl\" ; export QMAILQUEUE/g" /var/qmail/supervise/qmail-smtpd/run
    ;;
start)
    # Without this clamd won't start up sometimes
    # (clamd.log ownership gets messed up).
    #    ERROR: Problem with internal logger. Please check the permissions on the /var/log/clamav/clamd.log file.
    # I'm not sure what causes this, but this hack fixes it and
    # is probably harmless on systems that don't have this problem.
    chown `grep ^User /etc/clamd.conf | cut -d ' ' -f2` /var/log/clamav/*
    /usr/local/sbin/authdaemond start
    /etc/init.d/clamd start
    /etc/init.d/spamassassin start
    /etc/init.d/imap start
    /etc/init.d/imaps start
    svc -u /service/qmail-pop3d
    svc -u /service/qmail-smtpd
    svc -u /service/qmail-send
    /usr/bin/qmailctl start
    ;;
stop)
    /usr/bin/qmailctl stop
    svc -d /service/qmail-send
    svc -d /service/qmail-smtpd
    svc -d /service/qmail-pop3d
    /etc/init.d/imaps stop
    /etc/init.d/imap stop
    /etc/init.d/spamassassin stop
    /etc/init.d/clamd stop
    /usr/local/sbin/authdaemond stop
    ;;
lsq)
    find /var/qmail/queue -type f -exec ls -l {} \;
    ;;
*)
    cat <<HELPHERE
$0 COMMAND
status --- Show status of all mail services.
spamon  -- Enable spam/virus filtering in /var/qmail/supervise/qmail-smtpd/run.
spamoff -- Disable spam/virus filtering.
start ---- Start all mail services.
stop ----- Stop al mail services.
lsq ------ List all files in qmail queue folders.
HELPHERE
    ;;
esac
exit 0

aliases

Add this to bash aliases.

alias lsq='find /var/qmail/queue -type f -exec ls -l {} \;'