Difference between revisions of "Qmail notes"

From Noah.org
Jump to navigationJump to search
m
Line 2: Line 2:
 
[[Category:qmail]]
 
[[Category:qmail]]
 
== mail.sh ==
 
== mail.sh ==
<pre>
+
<pre>#! /bin/sh
#!/bin/sh
 
 
# Start or stop all mail services.
 
# Start or stop all mail services.
 
# Intended for a standard Qmail Rocks installation.
 
# Intended for a standard Qmail Rocks installation.
# Noah Spurrier
+
# Noah
  
 
case $1 in
 
case $1 in
 
status)
 
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
 
     /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)
 
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
 
     /usr/local/sbin/authdaemond start
 +
    /etc/init.d/clamd start
 +
    /etc/init.d/spamassassin start
 
     /etc/init.d/imap start
 
     /etc/init.d/imap start
 
     /etc/init.d/imaps start
 
     /etc/init.d/imaps start
Line 28: Line 50:
 
     /etc/init.d/imaps stop
 
     /etc/init.d/imaps stop
 
     /etc/init.d/imap stop
 
     /etc/init.d/imap stop
 +
    /etc/init.d/spamassassin stop
 +
    /etc/init.d/clamd stop
 
     /usr/local/sbin/authdaemond 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
 
esac

Revision as of 14:07, 5 February 2007

mail.sh

#! /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 {} \;'