Previous TOC Next

Technical document: Linux Mail Server Howto
Chapter 9 - Tieing it all together
Finally, we must make sure that postfix, authdeamond and courier-imap are started at boot time. How this is confgured is very much system dependent, what follows below should work for Redhat-based systems.

Stopping sendmail from starting at boot

If sendmail was already installed on your system, you will need to stop it from starting at boot time. How you should do this will depend on your system, but on Redhat platforms you can simply do:

> chkconfig sendmail off

Starting postfix at boot

Postfix does not come with it's own start-up script, so you will need to create one. Something like the below should suffice. Copy it to /etc/init.d/postfix and make executable:

#!/bin/sh
# chkconfig: 345 40 60
# description: Postfix mail transfer agent (MTA)

# An example /etc/init.d/postfix script

case "$1" in
        start)
                echo -n "Starting Postfix"
                /usr/sbin/postfix start
                ;;

        stop)
                echo -n "Halting Postfix"
                /usr/sbin/postfix stop
                ;;

        reload)
                echo -n "Postfix reload"
                /usr/sbin/postfix reload
                ;;
        restart)
                $0 stop
                /usr/bin/sleep 1
                $0 start
                ;;
        status)
                echo -n "Checking..."
                /usr/sbin/postfix check
                ;;
        *)
                echo "Usage: $0 {start|stop|reload|restart|status}"
                exit 1
        ;;
esac

exit 0

Starting authdaemond at boot

Likewise there is no start-up script for authdaemond. Create one, copy to /etc/init.d/authdaemond and make sure it is excutable:

#!/bin/sh
# chkconfig:            345 80 20
# description:          IMAP Auth Daemon

# An example /etc/init.d/authdaemond script

case "$1" in
'start')
        if [ -f /usr/local/sbin/authdaemond ]; then
                echo "Starting Courier authdaemon"
                /usr/local/sbin/authdaemond start
        fi
        ;;

'stop')
        if [ -f /usr/local/sbin/authdaemond ]; then
                echo "Stopping Courier authdaemon"
                /usr/local/sbin/authdaemond stop
        fi
        ;;

*)
        echo "Usage: $0 { start | stop }"
        exit 1
        ;;
esac

exit 0

Starting courier-imap at boot

Courier-imap does come supplied with a start-up script, which is located here:

/usr/lib/courier-imap/libexec/imapd-ssl.rc

Copy this script to /etc/init.d/imapd-ssl and make executable. However (on Redhat) you will have to make the following change to the script. Add:

# chkconfig: 345 80 20
# description: Courier IMAP Daemon

to the top of the script, just below the shebang. Having put the scripts in place, we can add to the appropriate rc directories:

chkconfig --add postfix
chkconfig --add authdaemond
chkconfig --add imapd-ssl

Now for the moment of truth... reboot your system, and, with any luck, sendmail will not start, and postfix, authdaemond and courier-imap will. Do some final tests, sending and receiving of mails etc - and there you have it - a fully featured mail server.

Previous: Chapter 8 - Creating virtual users and domains TOC Next: Appendix A - An example /etc/aliases file