#!/bin/bash # For Red Hat chkconfig # chkconfig: 3 30 80 # description: the qmail MTA PATH=/var/qmail/bin:/bin:/usr/bin:/usr/local/bin:/usr/local/sbin export PATH QMAILDUID=`id -u qmaild` NOFILESGID=`id -g qmaild` case "$1" in start) echo "Starting qmail" if svok /service/qmail-send ; then svc -u /service/qmail-send else echo qmail-send service not running fi if svok /service/qmail-smtpd ; then svc -u /service/qmail-smtpd else echo qmail-smtpd service not running fi if [ -d /var/lock/subsys ]; then touch /var/lock/subsys/qmail fi if svok /service/qmail-pop3d ; then svc -u /service/qmail-pop3d else echo qmail-pop3d service not running fi ;; stop) echo "Stopping qmail..." echo " qmail-smtpd" svc -d /service/qmail-smtpd echo " qmail-send" svc -d /service/qmail-send svc -d /service/qmail-send/log if [ -f /var/lock/subsys/qmail ]; then rm /var/lock/subsys/qmail fi echo " qmail-pop3d" svc -d /service/qmail-pop3d svc -d /service/qmail-pop3d/log ;; stat) svstat /service/qmail-send svstat /service/qmail-send/log svstat /service/qmail-smtpd svstat /service/qmail-smtpd/log svstat /service/qmail-pop3d svstat /service/qmail-pop3d/log qmail-qstat ;; doqueue|alrm|flush) echo "Sending ALRM signal to qmail-send." svc -a /service/qmail-send ;; queue) qmail-qstat qmail-qread ;; reload|hup) echo "Sending HUP signal to qmail-send." svc -h /service/qmail-send ;; pause) echo "Pausing qmail-send" svc -p /service/qmail-send echo "Pausing qmail-smtpd" svc -p /service/qmail-smtpd echo "Pausing qmail-pop3d" svc -p /service/qmail-pop3d ;; cont) echo "Continuing qmail-send" svc -c /service/qmail-send echo "Continuing qmail-smtpd" svc -c /service/qmail-smtpd echo "Continuing qmail-pop3d" svc -c /service/qmail-pop3d ;; restart) echo "Restarting qmail:" echo "* Stopping qmail-smtpd." svc -d /service/qmail-smtpd echo "* Stopping qmail-pop3d." svc -d /service/qmail-pop3d echo "* Sending qmail-send SIGTERM and restarting." svc -t /service/qmail-send echo "* Restarting qmail-smtpd." svc -u /service/qmail-smtpd echo "* Restarting qmail-pop3d" svc -t /service/qmail-pop3d ;; cdb) tcprules /etc/tcp.smtp.cdb /etc/tcp.smtp.tmp < /etc/tcp.smtp chmod 644 /etc/tcp.smtp.cdb echo "Reloaded /etc/tcp.smtp." ;; help) cat <