Here is my script for anyone interested.. its a hack of other more
intelligent people's script, but this is written for my rh6.1 system.  Note,
some minor syntax issues may have to be cleared up to run on something
besides rh6.1.  For instance, the service is called pop-3 instead of pop3,
and I didn't want to change the services file.

This assumes you are running tcpserver, and daemontools.  As far as 'full
logging' is concerned, its as full as qmail-send, and tcpserver dump
with -v.  If you want more from pop3d, read the current thread about
logging.  I've decided its not worth the extra effort.

I like this script the best out of the ones I've seen because it cleanly
gives you all the daemontool services right in your init script.

-Steve

-----Original Message-----
From: Thomas Foerster [mailto:[EMAIL PROTECTED]]
Sent: Thursday, November 18, 1999 6:11 AM
To: [EMAIL PROTECTED]
Subject: COMPLETE Script SMTP/POP3 - useful for every user


Hi there,

my qmail is working fine for 2 months now, but i'd like to have 2 *complete*
scripts with *complete* logging! One for SMTP and one for POP3.

I'd like to start qmail-smtp with ./qmail-smtp and qmail-pop3 with
./qmail-pop3
(from /etc/rc.d/init.d Redhat 6.0) :-)
AND i want to log every output from qmail-send and qmail-pop3d !
AND i want to be able to stop POP3 via the qmail-pop3 script, which i can't
do till now .. i always have to do a ps ax and then kill the tcpserver pop3
is running
with.

I used NO RPM, i build qmail from the source.
I'm using RedHat 6.0 , qmail is under /var/qmail

I hope that some of you can help me with this, and, if you need it, i can
give
you my current scripts.

Thanks A LOT,
  Thomas



#!/bin/sh

PATH=/var/qmail/bin:/bin:/usr/bin:/usr/local/sbin:/usr/local/bin
export PATH

QMAILDUID=`id -u qmaild`
NOFILESGID=`id -g qmaild`

case "$1" in
  start)
    echo -n "Starting qmail: qmail-send"
    supervise /var/lock/qmail/send /var/qmail/rc | setuser qmaill accustamp | \
        setuser qmaill cyclog /var/log/qmail &

    echo -n " qmail-smtpd"
    supervise /var/lock/qmail/smtpd tcpserver -v -x/etc/tcp.smtp.cdb \
        -u$QMAILDUID -g$NOFILESGID 0 smtp \
        /var/qmail/bin/qmail-smtpd-wrapper 2>&1 | setuser qmaill accustamp | \
        setuser qmaill cyclog /var/log/qmail/qmail-smtpd &

    echo -n " qmail-pop3d"
    supervise /var/lock/qmail/pop3d tcpserver -v 0 pop-3 /var/qmail/bin/qmail-popup 
mail.tandbergapplications.com \
    /bin/checkpassword /var/qmail/bin/qmail-pop3d Maildir &

    echo "."
    ;;
  stop)
    echo -n "Stopping qmail: qmail-smtpd"
    svc -dx /var/lock/qmail/smtpd
    echo -n " qmail-send"
    svc -dx /var/lock/qmail/send
    echo -n " qmail-pop3d"
    svc -dx /var/lock/qmail/pop3d
    echo "."
    ;;
  stat)
    echo "Checking qmail-send"
    svstat /var/lock/qmail/send
    echo "Checking qmail-smtpd"
    svstat /var/lock/qmail/smtpd
    echo "Checking qmail-pop3d"
    svstat /var/lock/qmail/pop3d
    echo "Checking queue"
    qmail-qstat
    ;;
  doqueue|alrm)
    echo "Sending ALRM signal to qmail-send."
    svc -a /var/lock/qmail/send
    ;;
  queue)
    qmail-qstat
    qmail-qread
    ;;
  reload|hup)
    echo "Sending HUP signal to qmail-send."
    svc -h /var/lock/qmail/send
    ;;
  pause)
    echo "Pausing qmail-send"
    svc -p /var/lock/qmail/send
    echo "Pausing qmail-smtpd"
    svc -p /var/lock/qmail/smtpd
    echo "Pausing qmail-pop3d"
    svc -p /var/lock/qmail/pop3d
    ;;
  cont)
    echo "Continuing qmail-send"
    svc -c /var/lock/qmail/send
    echo "Continuing qmail-smtpd"
    svc -c /var/lock/qmail/smtpd
    echo "Continuing qmail-pop3d"
    svc -c /var/lock/qmail/pop3d
    ;;
  restart)
    echo "Restarting qmail:"
    echo "* Stopping qmail-smtpd."
    svc -d /var/lock/qmail/smtpd
    echo "* Sending qmail-send SIGTERM and restarting."
    svc -t /var/lock/qmail/send
    echo "* Restarting qmail-smtpd."
    svc -u /var/lock/qmail/smtpd
    ;;
  cdb)
    tcprules /etc/tcp.smtp.cdb /etc/tcp.smtp.tmp < /etc/tcp.smtp
    chmod 644 /etc/tcp.smtp*
    echo "Reloaded /etc/tcp.smtp."
    ;;
  help)
    cat <<HELP
   stop -- stops mail service (smtp connections refused, nothing goes out)
  start -- starts mail service (smtp connection accepted, mail can go out)
  pause -- temporarily stops mail service (connections accepted, nothing leaves)
   cont -- continues paused mail service
   stat -- displays status of mail service
    cdb -- rebuild the tcpcontrol cdb file for smtp
restart -- stops and restarts smtp, sends qmail-send a TERM & restarts it
doqueue -- sends qmail-send ALRM, scheduling queued messages for delivery
 reload -- sends qmail-send HUP, rereading locals and virtualdomains
  queue -- shows status of queue
   alrm -- same as doqueue
    hup -- same as reload
HELP
    ;;
  *)
    echo "Usage: $0 {start|stop|restart|doqueue|reload|stat|pause|cont|cdb|queue|help}"
    exit 1
    ;;
esac

exit 0

Reply via email to