Matt Sergeant wrote:
Does anyone have an rc script for qpsmtpd that we could include in the
distro? I'm sure lots of people won't want to start it via daemontools.
Here's mine for RedHat using tcpserver (stripped out all the other
daemontools). I don't use forkserver, so I don't know how to start it
that way. This could be a start though.
-- Bryan
#!/bin/sh
#
# chkconfig: 345 81 46
# description: Start, stop, restart qpsmtpd
# customize
QMAILHOME=/var/qmail # ~qmail
USERID=`id -u qmaild` # UID to run with
GROUPID=`id -g qmaild` # GID to run with
PROG="qpsmtpd"
IP=`head -1 $QMAILHOME/qpsmtpd/config/IP` # which IP to use
LOGDIR=/var/log/qmail-qpsmtpd # directory to log to
LOGFILE=qpsmtpd.log # file to log to in LOGDIR
CDB=/etc/tcprules.d/qmail-smtpd.cdb # rules file
CONCURRENT=20 # number of concurrent connections
# (40 is the default of tcpserver)
PORT=smtp # port to watch
ARGS="-R -H -v" # options to pass to tcpserver
INITDIR=/etc/rc.d/init.d # location of initscripts
# Source function library
. /etc/rc.d/init.d/functions
export PATH=$QMAILHOME/bin:/usr/local/bin:$QMAILHOME/qpsmtpd:$PATH
export QMAILQUEUE="$QMAILHOME/bin/qmail-queue"
RETVAL=0
prog="tcpserver"
start() {
echo -n $"Starting $PROG: "
if [ -e $CDB ]; then
OPTS="$ARGS -c$CONCURRENT -x $CDB -u$USERID \
-g$GROUPID $IP $PORT $PROG"
tcpserver $OPTS > $LOGDIR/$LOGFILE &
else
OPTS="$ARGS -c$CONCURRENT -u$USERID -g$GROUPID \
$IP $PORT $PROG"
tcpserver $OPTS > $LOGDIR/$LOGFILE &
fi
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/qpsmtpd
return $RETVAL
}
stop() {
echo -n $"Stopping $PROG: "
# we probably have a better way to do this.. don't want to kill
any
# other tcpservers
killproc tcpserver
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm /var/lock/subsys/qpsmtpd
return $RETVAL
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
esac