qpsmtpd Wiki

[[deploy:sysvinit]]

You are here: start » deploy » sysvinit

Login

You are currently not logged in! Enter your authentication credentials below to log in. You need to have cookies enabled to log in.

Login

You don't have an account yet? Just get one: Register

Forgotten your password? Get a new one: Set new password

SysV-style init.d/rc-Scripts for qpsmtpd

The RPM package has a Red Hat-based init.d script for qpsmtpd-forkserver configured for the RPM install layout, however it is easy to modify for a standard tarball install layout if desired. Once the init.d script in place and configured, qpsmtpd-forkserver can be managed via chkconfig and service on RH-based distros.

The debian package also contains a similar script for Debian.

The following init script will work with most Red Hat, Mandrake or related systems:

#! /bin/bash
#
# qpsmtpd-forkserver          Start/Stop the qpsmtpd forking server
#
# chkconfig: 2345 90 60
# description: qpsmtpd is a flexible smtpd daemon written in Perl. \
#              Apart from the core SMTP features, all functionality is \
#              implemented in small "extension plugins" using the easy \
#              to use object oriented plugin API.
# processname: qpsmtpd-forkserver
# config: /etc/qpsmtpd
# pidfile: /var/run/qpsmtpd-forkserver.pid
 
# cleanup environment a bit.
unset PERL_UNICODE
 
# Source function library.
. /etc/init.d/functions
. /etc/sysconfig/qpsmtpd-forkserver
 
RETVAL=0
 
# See how we were called.
 
dir="/usr/share/qpsmtpd"
prog="qpsmtpd-forkserver"
 
start() {
        echo -n $"Starting $dir/$prog: "
        trap "" 1
        $dir/$prog --detach $QPSMTPD_OPTIONS
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog
        return $RETVAL
}
 
stop() {
        echo -n $"Stopping $dir/$prog: "
        killproc $prog
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog
        return $RETVAL
}
 
rhstatus() {
        status qpsmtpd-forkserver
}
 
restart() {
        stop
        start
}
 
reload() {
        stop
        start
}
 
case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  restart)
        restart
        ;;
  reload)
        reload
        ;;
  status)
        rhstatus
        ;;
  condrestart)
        [ -f /var/lock/subsys/$prog ] && restart || :
        ;;
  *)
        echo $"Usage: $0 {start|stop|status|reload|restart|condrestart}"
        exit 1
esac
 
exit $?

You will also need to add a sysconfig file to /etc/sysconfig with similar contents to the below:

QPSMTPD_OPTIONS="-p 25 -l 127.0.0.l -m 5"
export QPSMTPD_CONFIG=/etc/qpsmtpd
export HOME=~smtpd

FIXME

Gentoo init.d script

Very simple script for gentoo:

#!/sbin/runscript
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
 
DIR=/usr/local/qpsmtpd
PROG=qpsmtpd-forkserver
 
source /etc/conf.d/qpsmtpd
 
depend() {
        need net
}
 
checkconfig() {
        if ! [ -d /etc/qpsmtpd ]; then
                eerror "Configuration directory /etc/qpsmtpd does not exist."
                return 1
        fi
 
        return 0
}
 
start() {
        checkconfig || return 1
 
        ebegin "Starting qpsmtpd"
        $DIR/$PROG --detach $QPSMTPD_OPTIONS --pid-file /var/run/qpsmtpd-forkserver.pid
        eend $?
}
 
stop() {
        ebegin "Stopping qpsmtpd"
        killall $PROG
        eend $?
}