All pastes #11168 Raw Edit

qmail start file

public shellscript v1 · immutable
#11168 ·published 2005-05-07 16:21 UTC
rendered paste body
#!/bin/bashalias_empty="|/usr/sbin/qmail-procmail"logger="splogger qmail"test -x /usr/sbin/qmail-start || exit 0test -x /usr/sbin/qmail-send || exit 0case "$1" in    start)        echo -n "Starting mail-transfer agent: qmail"        sh -c "start-stop-daemon --start --quiet --user qmails \                 --exec /usr/sbin/qmail-send \                 --startas /usr/sbin/qmail-start -- \"$alias_empty\" $logger &"        ulimit -v 8192        sh -c "start-stop-daemon --start --quiet --user qmaild \            --exec /usr/bin/tcpserver -- -R -H \            -u `id -u qmaild` -g `id -g nobody` -x /etc/tcp.smtp.cdb 0 smtp \            /usr/bin/rblsmtpd -b \                        -r cbl.abuseat.org \                        -r sbl.spamhaus.org \            /usr/sbin/qmail-smtpd 2>&1 | $logger -t qmail -p mail.notice &"        sh -c "start-stop-daemon --start --quiet --user root \            --exec /usr/bin/tcpserver -- -R -H \            0 pop-3 /usr/sbin/qmail-popup `hostname` \            /usr/sbin/mysqmail-checkpwd /usr/sbin/mysqmail-qmail-pop3d Maildir &"        echo "."        ;;    stop)        echo -n "Stopping mail-transfer agent: qmail"        if [ "`pidof /usr/sbin/qmail-send`" ] ; then            start-stop-daemon --user qmails --stop --quiet --oknodo --exec /usr/sbin/qmail-send            start-stop-daemon --user qmaild --stop --quiet --oknodo --exec /usr/bin/tcpserver            # Uncomment the following line if you have enabled the pop3 server            start-stop-daemon --user root --stop --quiet --oknodo --exec /usr/bin/tcpserver            # Wait until the timeout for qmail processes to die.            count=10            numdots=0            while ([ $count != 0 ]) do                let count=$count-1                if [ "`pidof /usr/sbin/qmail-send`" ] ; then                    echo -n .                    let numdots=$numdots+1                    sleep 1                else                    count=0                fi            done            # If it's not dead yet, kill it.            if [ "`pidof /usr/sbin/qmail-send`" ] ; then                echo -n " TIMEOUT!"                kill -KILL `pidof /usr/sbin/qmail-send`            else                case $numdots in                  0) echo "." ;;                  1) echo ;;                  *) echo " done." ;;                esac            fi        else            echo " not running.";        fi        ;;    restart)        $0 stop        $0 start        ;;    reload|force-reload)        echo "Reloading 'locals' and 'virtualdomains' control files."        start-stop-daemon --stop --quiet --oknodo --signal HUP --exec /usr/sbin/qmail-send        ;;    *)        echo 'Usage: /etc/init.d/qmail {start|stop|restart|reload}'        exit 1esacexit 0