Postfix boot-script for Slackware Linux

Category: Software and Systems Engineering
Author: Sean O'Donnell
Wed, May. 2nd, 2007 @ 23:06:29 (MDT)

/etc/rc.d/rc.postfix

Here's a simple Postfix boot-script that I created for Slackware Linux.

Postfix doesn't come included with Slackware Linux, so neither does this boot-script. This is intended for users who manually install postfix (from the source) on Slackware Linux.

#!/bin/sh
#
# /etc/rc.d/rc.postfix
#
# Postfix init script for Slackware Linux
#
# Author: Sean O'Donnell 
#

# define the path to the postfix executable
POSTFIX=/sbin/postfix

function start_postfix()
{
        echo "Starting Postfix..."
        $POSTFIX start
}

function stop_postfix()
{
        echo "Stopping Postfix..."
        $POSTFIX stop
}

function restart_postfix()
{
        stop_postfix
        sleep 5
        start_postfix
}

case "$1" in
   'start')
      start_postfix ;;
   'stop')
      stop_postfix ;;
   'restart')
      restart_postfix ;;
   *)
      echo "usage $0 start|stop|restart" ;;
esac

Copy/Paste/Save the script (above) as /etc/rc.d/rc.postfix.

Make the script executable.

chmod +x /etc/rc.d/rc.postfix

/etc/rc.d/rc.M

You'll then need to add the following lines to (the end of) your '/etc/rc.d/rc.M' file:

# start the postfix SMTP service
if [ -x /etc/rc.d/rc.postfix ]; then
        /etc/rc.d/rc.postfix start
fi

Postfix should now automatically start during the initial boot process.

Copyleft (<) 1998-2019 www.seanodonnell.com