This package creates all the needed basic config files to run qmail,
and provides NetBSD-style rc.d scripts and an example mailer.conf. The rc.d scripts used to belong directly to the qmail package. Changes made during the move here: * Rename qmailfoo_softlimit to the more accurate qmailfoo_datalimit. * Parameterize logging as qmailfoo_logcmd (default: splogger). * Run all sploggers (not just qmail-send's) as user qmaill, rather than root. * Replace "@CAT@" with "@HEAD@ -1" for files expected to contain one line.
This commit is contained in:
parent
9da5a78de2
commit
fab61096d2
13 changed files with 571 additions and 0 deletions
2
mail/qmail-run/DESCR
Normal file
2
mail/qmail-run/DESCR
Normal file
|
@ -0,0 +1,2 @@
|
|||
This package creates all the needed basic config files to run qmail,
|
||||
and provides NetBSD-style rc.d scripts and an example mailer.conf.
|
43
mail/qmail-run/INSTALL
Normal file
43
mail/qmail-run/INSTALL
Normal file
|
@ -0,0 +1,43 @@
|
|||
QMAIL_QUEUE_EXTRA=@QMAIL_QUEUE_EXTRA@
|
||||
|
||||
psmsg='# This file was auto-generated by pkgsrc.'
|
||||
|
||||
case ${STAGE} in
|
||||
|
||||
POST-INSTALL)
|
||||
cd ${LOCALBASE}/share/qmail/setup && ./config-fast `./hostname`
|
||||
|
||||
cd ${PKG_SYSCONFDIR}/alias && ${TOUCH} .qmail-postmaster .qmail-mailer-daemon .qmail-root
|
||||
|
||||
if ! [ -s ${PKG_SYSCONFDIR}/control/concurrencyincoming ]; then
|
||||
${ECHO} 20 > ${PKG_SYSCONFDIR}/control/concurrencyincoming
|
||||
${ECHO} $psmsg >> ${PKG_SYSCONFDIR}/control/concurrencyincoming
|
||||
${CHMOD} 644 ${PKG_SYSCONFDIR}/control/concurrencyincoming
|
||||
fi
|
||||
|
||||
if ! [ -s ${PKG_SYSCONFDIR}/control/defaultdelivery ]; then
|
||||
${ECHO} ./Mailbox > ${PKG_SYSCONFDIR}/control/defaultdelivery
|
||||
${ECHO} $psmsg >> ${PKG_SYSCONFDIR}/control/defaultdelivery
|
||||
${CHMOD} 644 ${PKG_SYSCONFDIR}/control/defaultdelivery
|
||||
fi
|
||||
|
||||
pop3rule=':allow'
|
||||
smtprule='127.:allow,RELAYCLIENT=""'
|
||||
for i in pop3 smtp; do
|
||||
if ! [ -s ${PKG_SYSCONFDIR}/tcp.${i} ]; then
|
||||
${ECHO} $psmsg > ${PKG_SYSCONFDIR}/tcp.${i}
|
||||
eval ${ECHO} \"\$${i}rule\" > ${PKG_SYSCONFDIR}/tcp.${i}
|
||||
fi
|
||||
${CHMOD} 644 ${PKG_SYSCONFDIR}/tcp.${i}
|
||||
${LOCALBASE}/bin/tcprules ${PKG_SYSCONFDIR}/tcp.${i}.cdb ${PKG_SYSCONFDIR}/tcp.${i}.tmp < ${PKG_SYSCONFDIR}/tcp.${i}
|
||||
${CHMOD} 644 ${PKG_SYSCONFDIR}/tcp.${i}.cdb
|
||||
done
|
||||
|
||||
if ! [ -z ${QMAIL_QUEUE_EXTRA} ]; then
|
||||
${ECHO} $psmsg >> ${PKG_SYSCONFDIR}/alias/.qmail-${QMAIL_QUEUE_EXTRA}
|
||||
${CHMOD} 644 ${PKG_SYSCONFDIR}/alias/.qmail-${QMAIL_QUEUE_EXTRA}
|
||||
fi
|
||||
|
||||
;;
|
||||
|
||||
esac
|
21
mail/qmail-run/MESSAGE
Normal file
21
mail/qmail-run/MESSAGE
Normal file
|
@ -0,0 +1,21 @@
|
|||
===========================================================================
|
||||
$NetBSD: MESSAGE,v 1.1.1.1 2004/08/02 03:59:21 schmonz Exp $
|
||||
|
||||
To enable qmail for
|
||||
|
||||
Local and outgoing deliveries:
|
||||
- Check the configuration files in ${PKG_SYSCONFDIR}.
|
||||
- Modify /etc/mailer.conf (see share/examples/qmail-run/mailer.conf).
|
||||
- Set qmailsend=YES in /etc/rc.conf.
|
||||
|
||||
SMTP:
|
||||
- Set qmailsmtpd=YES in /etc/rc.conf.
|
||||
|
||||
POP3 (only for Maildirs):
|
||||
- Set qmailpop3d=YES in /etc/rc.conf.
|
||||
|
||||
Make the queue visible to local non-root users:
|
||||
- Set qmailqread=YES in /etc/rc.conf.
|
||||
- Change the mailq entry in /etc/mailer.conf to qmail-qread-client.
|
||||
|
||||
===========================================================================
|
66
mail/qmail-run/Makefile
Normal file
66
mail/qmail-run/Makefile
Normal file
|
@ -0,0 +1,66 @@
|
|||
# $NetBSD: Makefile,v 1.1.1.1 2004/08/02 03:59:21 schmonz Exp $
|
||||
#
|
||||
|
||||
DISTNAME= qmail-run-20040801
|
||||
CATEGORIES= mail
|
||||
MASTER_SITES= # empty
|
||||
DISTFILES= # empty
|
||||
|
||||
MAINTAINER= schmonz@NetBSD.org
|
||||
COMMENT= Configures qmail to receive and deliver mail
|
||||
|
||||
DEPENDS_QMAIL= {qmail>=1.03nb8,netqmail>=1.05nb1}:../../mail/qmail
|
||||
DEPENDS+= ${DEPENDS_QMAIL}
|
||||
.if !exists(/usr/sbin/mailwrapper)
|
||||
DEPENDS+= mailwrapper-[0-9]*:../../mail/mailwrapper
|
||||
.endif
|
||||
.if !exists(/etc/rc.subr)
|
||||
DEPENDS+= rc.subr-[0-9]*:../../pkgtools/rc.subr
|
||||
.endif
|
||||
|
||||
PKG_INSTALLATION_TYPES= overwrite pkgviews
|
||||
|
||||
WRKSRC= ${WRKDIR}
|
||||
NO_CHECKSUM= # defined
|
||||
|
||||
USE_PKGINSTALL= yes
|
||||
INSTALL_EXTRA_TMPL+= ${.CURDIR}/INSTALL
|
||||
FILES_SUBST+= QMAIL_QUEUE_EXTRA=${QMAIL_QUEUE_EXTRA}
|
||||
RCD_SCRIPTS= qmail qmailqread qmailpop3d qmailsend qmailsmtpd
|
||||
|
||||
INSTALLATION_DIRS= bin share/doc/qmail-run share/examples/qmail-run
|
||||
|
||||
.include "../../mk/bsd.prefs.mk"
|
||||
|
||||
# Detect the PKG_SYSCONFDIR of the installed qmail or netqmail, so we
|
||||
# can create config files there and refer to them from rc.d scripts.
|
||||
.if !empty(PHASES_AFTER_EXTRACT:M${PKG_PHASE})
|
||||
INSTALLED_QMAIL!= \
|
||||
dep=`${PKG_BEST_EXISTS} ${DEPENDS_QMAIL:C/:.*$//:Q:S/\ / /g}`; \
|
||||
case "$$dep" in \
|
||||
"") ${ECHO} "qmail_not_found_" ;; \
|
||||
*) ${ECHO} "$$dep" ;; \
|
||||
esac
|
||||
. if empty(INSTALLED_QMAIL:M*_not_found_)
|
||||
. if !defined(PKG_SYSCONFDIR.qmail-run)
|
||||
PKG_SYSCONFDIR.qmail-run!= \
|
||||
${PKG_INFO} -qB ${INSTALLED_QMAIL} | \
|
||||
${SED} -n '/^PKG_SYSCONFDIR=/s|^PKG_SYSCONFDIR=[ ]*||p'
|
||||
. endif
|
||||
. endif
|
||||
.endif
|
||||
|
||||
do-build:
|
||||
@${SED} ${FILES_SUBST_SED} ${FILESDIR}/README.pkgsrc \
|
||||
> ${WRKDIR}/README.pkgsrc
|
||||
@${SED} ${FILES_SUBST_SED} ${FILESDIR}/mailer.conf \
|
||||
> ${WRKDIR}/mailer.conf
|
||||
@${SED} ${FILES_SUBST_SED} ${FILESDIR}/qmail-qread-client.sh \
|
||||
> ${WRKDIR}/qmail-qread-client
|
||||
|
||||
do-install:
|
||||
${INSTALL_SCRIPT} ${WRKDIR}/qmail-qread-client ${PREFIX}/bin
|
||||
${INSTALL_DATA} ${WRKDIR}/README.pkgsrc ${PREFIX}/share/doc/qmail-run
|
||||
${INSTALL_DATA} ${WRKDIR}/mailer.conf ${PREFIX}/share/examples/qmail-run
|
||||
|
||||
.include "../../mk/bsd.pkg.mk"
|
6
mail/qmail-run/PLIST
Normal file
6
mail/qmail-run/PLIST
Normal file
|
@ -0,0 +1,6 @@
|
|||
@comment $NetBSD: PLIST,v 1.1.1.1 2004/08/02 03:59:21 schmonz Exp $
|
||||
bin/qmail-qread-client
|
||||
share/doc/qmail-run/README.pkgsrc
|
||||
share/examples/qmail-run/mailer.conf
|
||||
@dirrm share/examples/qmail-run
|
||||
@dirrm share/doc/qmail-run
|
44
mail/qmail-run/files/README.pkgsrc
Normal file
44
mail/qmail-run/files/README.pkgsrc
Normal file
|
@ -0,0 +1,44 @@
|
|||
Getting help
|
||||
============
|
||||
|
||||
You've installed an automated and customized qmail-run package. If
|
||||
you're having trouble getting the qmail daemons to run, ask the
|
||||
package's maintainer (<schmonz-nbqmail@schmonz.com>).
|
||||
|
||||
While qmail includes installation instructions, many members of
|
||||
the qmail list instead recommend following Dave Sill's "Life with
|
||||
qmail" document:
|
||||
|
||||
<URL:http://www.lifewithqmail.org/lwq.html>
|
||||
|
||||
The qmail package you've installed follows LWQ in many aspects,
|
||||
but consciously deviates from it in others. Therefore, if you need
|
||||
to ask for help on the qmail list, please mention that you use the
|
||||
pkgsrc qmail-run package. If you can first reproduce your problem
|
||||
on a manual LWQ-style installation, your request for help is likely
|
||||
to be better received.
|
||||
|
||||
It is highly recommended that you read Charles Cazabon's "12 Steps
|
||||
to qmail List Bliss" before posting to the list:
|
||||
|
||||
<URL:http://www.qcc.ca/~charlesc/writings/12-steps-to-qmail-list-bliss.html>
|
||||
|
||||
|
||||
Deviations from LWQ
|
||||
===================
|
||||
|
||||
LWQ suggests doing some things that the qmail package doesn't do:
|
||||
* Copying a script from /var/qmail/boot to /var/qmail/rc.
|
||||
* Configuring svscan(8) to run at boot.
|
||||
* Creating and/or populating /service.
|
||||
* Using supervise(8) and multilog(8).
|
||||
* Using the qmailctl script to control qmail.
|
||||
* Using the inst_check script to verify the installation.
|
||||
* Storing tcp.smtp{,cdb} in /etc.
|
||||
* Renaming the system sendmail(8) and marking it non-executable.
|
||||
|
||||
Instead, to behave more like a typical pkgsrc package, the package:
|
||||
* Provides NetBSD-style rc.d scripts, including one very similar to qmailctl.
|
||||
* Sends log messages to syslog(3) by default.
|
||||
* Stores tcp.smtp{,cdb} and tcp.pop3{,cdb} in ${PKG_SYSCONFDIR}.
|
||||
* Uses mailwrapper(8) and mailer.conf(5).
|
10
mail/qmail-run/files/mailer.conf
Normal file
10
mail/qmail-run/files/mailer.conf
Normal file
|
@ -0,0 +1,10 @@
|
|||
# $NetBSD: mailer.conf,v 1.1.1.1 2004/08/02 03:59:22 schmonz Exp $
|
||||
#
|
||||
# Use qmail as the system mailer.
|
||||
#
|
||||
sendmail @LOCALBASE@/bin/sendmail
|
||||
send-mail @LOCALBASE@/bin/sendmail
|
||||
mailq @LOCALBASE@/bin/qmail-qread
|
||||
newaliases @LOCALBASE@/bin/newaliases
|
||||
hoststat @LOCALBASE@/bin/qmail-tcpto
|
||||
purgestat @LOCALBASE@/bin/qmail-tcpok
|
7
mail/qmail-run/files/qmail-qread-client.sh
Normal file
7
mail/qmail-run/files/qmail-qread-client.sh
Normal file
|
@ -0,0 +1,7 @@
|
|||
#!@SH@
|
||||
#
|
||||
# Client program to allow local non-root users to see the queue.
|
||||
# Requires that the corresponding server program be running. From
|
||||
# Steinar Haug.
|
||||
|
||||
exec @LOCALBASE@/bin/tcpclient -RHl0 -- 127.0.0.1 20025 @SH@ -c 'exec @CAT@ <&6'
|
90
mail/qmail-run/files/qmail.sh
Normal file
90
mail/qmail-run/files/qmail.sh
Normal file
|
@ -0,0 +1,90 @@
|
|||
#!@RCD_SCRIPTS_SHELL@
|
||||
#
|
||||
# $NetBSD: qmail.sh,v 1.1.1.1 2004/08/02 03:59:22 schmonz Exp $
|
||||
#
|
||||
# Master script for administrators to control qmail services.
|
||||
# Usage resembles the qmailctl script from "Life with qmail".
|
||||
#
|
||||
|
||||
# KEYWORD: nostart
|
||||
|
||||
if [ -f /etc/rc.subr ]; then
|
||||
. /etc/rc.subr
|
||||
fi
|
||||
|
||||
rcd_dir=`@DIRNAME@ $0`
|
||||
|
||||
# NOTE: run_rc_command sets $rc_arg
|
||||
#
|
||||
forward_commands()
|
||||
{
|
||||
# Backward compat with NetBSD <1.6:
|
||||
[ -z "$rc_arg" ] && rc_arg=$_arg
|
||||
|
||||
for file in $COMMAND_LIST; do
|
||||
$rcd_dir/$file $rc_arg
|
||||
done
|
||||
}
|
||||
|
||||
reverse_commands()
|
||||
{
|
||||
# Backward compat with NetBSD <1.6:
|
||||
[ -z "$rc_arg" ] && rc_arg=$_arg
|
||||
|
||||
REVCOMMAND_LIST=
|
||||
for file in $COMMAND_LIST; do
|
||||
REVCOMMAND_LIST="$file $REVCOMMAND_LIST"
|
||||
done
|
||||
for file in $REVCOMMAND_LIST; do
|
||||
$rcd_dir/$file $rc_arg
|
||||
done
|
||||
}
|
||||
|
||||
qmailrcd()
|
||||
{
|
||||
for service in $@; do
|
||||
$rcd_dir/qmail${service} $rc_arg
|
||||
done
|
||||
}
|
||||
|
||||
qmail_help()
|
||||
{
|
||||
@CAT@ <<HELP
|
||||
stop -- stops mail service (smtp connections refused, nothing goes out)
|
||||
start -- starts mail service (smtp connection accepted, mail can go out)
|
||||
pause -- temporarily stops mail service (connections accepted, nothing leaves)
|
||||
cont -- continues paused mail service
|
||||
stat -- displays status of mail service
|
||||
cdb -- rebuild the tcpserver cdb file for smtp and/or pop3
|
||||
restart -- stops and restarts smtp, sends qmail-send a TERM & restarts it
|
||||
doqueue -- schedules queued messages for immediate delivery
|
||||
reload -- sends qmail-send HUP, rereading locals and virtualdomains
|
||||
queue -- shows status of queue
|
||||
alrm -- same as doqueue
|
||||
flush -- same as doqueue
|
||||
hup -- same as reload
|
||||
HELP
|
||||
}
|
||||
|
||||
COMMAND_LIST="qmailsend qmailsmtpd qmailpop3d"
|
||||
|
||||
name="qmail"
|
||||
start_cmd="forward_commands"
|
||||
stop_cmd="reverse_commands"
|
||||
doqueue_cmd="qmailrcd send"; alrm_cmd=${doqueue_cmd}; flush_cmd=${doqueue_cmd}
|
||||
reload_cmd="qmailrcd send"; hup_cmd=${reload_cmd}
|
||||
status_cmd="forward_commands"; stat_cmd=${status_cmd}
|
||||
pause_cmd="forward_commands"
|
||||
cont_cmd="forward_commands"
|
||||
cdb_cmd="qmailrcd smtpd pop3d"
|
||||
queue_cmd="qmailrcd send"
|
||||
help_cmd="qmail_help"
|
||||
extra_commands="pause cont stat status cdb doqueue reload queue alrm flush hup help"
|
||||
|
||||
if [ -f /etc/rc.subr ]; then
|
||||
run_rc_command "$1"
|
||||
else
|
||||
@ECHO@ -n " ${name}"
|
||||
_arg="$1"
|
||||
${start_cmd}
|
||||
fi
|
79
mail/qmail-run/files/qmailpop3d.sh
Normal file
79
mail/qmail-run/files/qmailpop3d.sh
Normal file
|
@ -0,0 +1,79 @@
|
|||
#!@RCD_SCRIPTS_SHELL@
|
||||
#
|
||||
# $NetBSD: qmailpop3d.sh,v 1.1.1.1 2004/08/02 03:59:21 schmonz Exp $
|
||||
#
|
||||
# Script to control qmail-pop3d (POP3 server for Maildirs).
|
||||
#
|
||||
|
||||
# PROVIDE: qmailpop3d mail
|
||||
|
||||
. /etc/rc.subr
|
||||
|
||||
name="qmailpop3d"
|
||||
rcvar=${name}
|
||||
required_files="@PKG_SYSCONFDIR@/control/me"
|
||||
required_files="${required_files} @PKG_SYSCONFDIR@/tcp.pop3.cdb"
|
||||
command="@LOCALBASE@/bin/tcpserver"
|
||||
procname=${name}
|
||||
start_precmd="qmailpop3d_precmd"
|
||||
extra_commands="stat pause cont cdb"
|
||||
stat_cmd="qmailpop3d_stat"
|
||||
pause_cmd="qmailpop3d_pause"
|
||||
cont_cmd="qmailpop3d_cont"
|
||||
cdb_cmd="qmailpop3d_cdb"
|
||||
|
||||
# User-settable rc.conf variables and their default values:
|
||||
qmailpop3d_postenv=${qmailpop3d_postenv-""}
|
||||
qmailpop3d_tcpflags=${qmailpop3d_tcpflags-"-v -R -H -l 0"}
|
||||
qmailpop3d_tcphost=${qmailpop3d_tcphost-"0"}
|
||||
qmailpop3d_tcpport=${qmailpop3d_tcpport-"110"}
|
||||
qmailpop3d_datalimit=${qmailpop3d_datalimit-"2000000"}
|
||||
qmailpop3d_pretcpserver=${qmailpop3d_pretcpserver-""}
|
||||
qmailpop3d_prepop3d=${qmailpop3d_prepop3d-""}
|
||||
qmailpop3d_checkpassword=${qmailpop3d_checkpassword-"@LOCALBASE@/bin/checkpassword"}
|
||||
qmailpop3d_maildirname=${qmailpop3d_maildirname-"Maildir"}
|
||||
qmailpop3d_logcmd=${qmailpop3d_logcmd-"@LOCALBASE@/bin/setuidgid qmaill @LOCALBASE@/bin/splogger nb${name}"}
|
||||
|
||||
qmailpop3d_precmd()
|
||||
{
|
||||
# tcpserver(1) is akin to inetd(8), but runs one service per process.
|
||||
# We want to signal only the tcpserver process responsible for POP
|
||||
# service. Use argv0(1) to set procname to "qmailpop3d".
|
||||
command="@SETENV@ - ${qmailpop3d_postenv} @LOCALBASE@/bin/softlimit -m ${qmailpop3d_datalimit} ${qmailpop3d_pretcpserver} @LOCALBASE@/bin/argv0 @LOCALBASE@/bin/tcpserver ${name} ${qmailpop3d_tcpflags} -x @PKG_SYSCONFDIR@/tcp.pop3.cdb ${qmailpop3d_tcphost} ${qmailpop3d_tcpport} @LOCALBASE@/bin/qmail-popup `@HEAD@ -1 @PKG_SYSCONFDIR@/control/me` ${qmailpop3d_checkpassword} ${qmailpop3d_prepop3d} @LOCALBASE@/bin/qmail-pop3d ${qmailpop3d_maildirname} 2>&1 | ${qmailpop3d_logcmd}"
|
||||
command_args="&"
|
||||
rc_flags=""
|
||||
}
|
||||
|
||||
qmailpop3d_stat()
|
||||
{
|
||||
run_rc_command status
|
||||
}
|
||||
|
||||
qmailpop3d_pause()
|
||||
{
|
||||
if ! statusmsg=`run_rc_command status`; then
|
||||
@ECHO@ $statusmsg
|
||||
return 1
|
||||
fi
|
||||
@ECHO@ "Pausing ${name}."
|
||||
kill -STOP $rc_pid
|
||||
}
|
||||
|
||||
qmailpop3d_cont()
|
||||
{
|
||||
if ! statusmsg=`run_rc_command status`; then
|
||||
@ECHO@ $statusmsg
|
||||
return 1
|
||||
fi
|
||||
@ECHO@ "Continuing ${name}."
|
||||
kill -CONT $rc_pid
|
||||
}
|
||||
|
||||
qmailpop3d_cdb()
|
||||
{
|
||||
echo "Reloading @PKG_SYSCONFDIR@/tcp.pop3."
|
||||
@LOCALBASE@/bin/tcprules @PKG_SYSCONFDIR@/tcp.pop3.cdb @PKG_SYSCONFDIR@/tcp.pop3.tmp < @PKG_SYSCONFDIR@/tcp.pop3
|
||||
@CHMOD@ 644 @PKG_SYSCONFDIR@/tcp.pop3.cdb
|
||||
}
|
||||
load_rc_config $name
|
||||
run_rc_command "$1"
|
31
mail/qmail-run/files/qmailqread.sh
Normal file
31
mail/qmail-run/files/qmailqread.sh
Normal file
|
@ -0,0 +1,31 @@
|
|||
#!@RCD_SCRIPTS_SHELL@
|
||||
#
|
||||
# $NetBSD: qmailqread.sh,v 1.1.1.1 2004/08/02 03:59:21 schmonz Exp $
|
||||
#
|
||||
# Script to control a service providing local non-root users access
|
||||
# to see the queue. Adapted from a script by Steinar Haug.
|
||||
#
|
||||
|
||||
# PROVIDE: qmailqread mail
|
||||
# REQUIRE: qmailsend
|
||||
|
||||
. /etc/rc.subr
|
||||
|
||||
name="qmailqread"
|
||||
rcvar=${name}
|
||||
command="@LOCALBASE@/bin/tcpserver"
|
||||
procname=${name}
|
||||
start_precmd="qmailqread_precmd"
|
||||
|
||||
# User-settable rc.conf variables and their default values:
|
||||
qmailqread_logcmd=${qmailqread_logcmd-"@LOCALBASE@/bin/setuidgid qmaill @LOCALBASE@/bin/splogger nb${name}"}
|
||||
|
||||
qmailqread_precmd()
|
||||
{
|
||||
command="@SETENV@ - @LOCALBASE@/bin/argv0 @LOCALBASE@/bin/tcpserver ${name} -R -1 -u `@ID@ -u qmails` -g `@ID@ -g qmails` 127.0.0.1 20025 @LOCALBASE@/bin/qmail-qread 2>&1 | ${qmailqread_logcmd}"
|
||||
command_args="&"
|
||||
rc_flags=""
|
||||
}
|
||||
|
||||
load_rc_config $name
|
||||
run_rc_command "$1"
|
92
mail/qmail-run/files/qmailsend.sh
Normal file
92
mail/qmail-run/files/qmailsend.sh
Normal file
|
@ -0,0 +1,92 @@
|
|||
#!@RCD_SCRIPTS_SHELL@
|
||||
#
|
||||
# $NetBSD: qmailsend.sh,v 1.1.1.1 2004/08/02 03:59:21 schmonz Exp $
|
||||
#
|
||||
# Script to control qmail-send (local and outgoing mail).
|
||||
#
|
||||
|
||||
# PROVIDE: qmailsend mail
|
||||
# REQUIRE: LOGIN
|
||||
# KEYWORD: shutdown
|
||||
|
||||
. /etc/rc.subr
|
||||
|
||||
name="qmailsend"
|
||||
rcvar=${name}
|
||||
required_files="@PKG_SYSCONFDIR@/control/defaultdelivery"
|
||||
required_files="${required_files} @PKG_SYSCONFDIR@/control/me"
|
||||
command="@LOCALBASE@/bin/qmail-send"
|
||||
start_precmd="qmailsend_precmd"
|
||||
extra_commands="stat pause cont doqueue reload queue alrm flush hup"
|
||||
stat_cmd="qmailsend_stat"
|
||||
pause_cmd="qmailsend_pause"
|
||||
cont_cmd="qmailsend_cont"
|
||||
doqueue_cmd="qmailsend_doqueue"
|
||||
queue_cmd="qmailsend_queue"
|
||||
alrm_cmd="qmailsend_doqueue"
|
||||
flush_cmd="qmailsend_doqueue"
|
||||
hup_cmd="qmailsend_hup"
|
||||
|
||||
# User-settable rc.conf variables and their default values:
|
||||
qmailsend_postenv=${qmailsend_postenv-"PATH=@LOCALBASE@/bin:$PATH"}
|
||||
qmailsend_defaultdelivery=${qmailsend_defaultdelivery-"`@HEAD@ -1 @PKG_SYSCONFDIR@/control/defaultdelivery`"}
|
||||
qmailsend_logcmd=${qmailsend_logcmd-"@LOCALBASE@/bin/splogger nb${name}"}
|
||||
|
||||
qmailsend_precmd()
|
||||
{
|
||||
# qmail-start(8) starts the various qmail processes, then exits.
|
||||
# qmail-send(8) is the process we want to signal later.
|
||||
command="@SETENV@ - ${qmailsend_postenv} qmail-start '$qmailsend_defaultdelivery' ${qmailsend_logcmd}"
|
||||
command_args="&"
|
||||
rc_flags=""
|
||||
}
|
||||
|
||||
qmailsend_stat()
|
||||
{
|
||||
run_rc_command status
|
||||
}
|
||||
|
||||
qmailsend_pause()
|
||||
{
|
||||
if ! statusmsg=`run_rc_command status`; then
|
||||
@ECHO@ $statusmsg
|
||||
return 1
|
||||
fi
|
||||
@ECHO@ "Pausing ${name}."
|
||||
kill -STOP $rc_pid
|
||||
}
|
||||
|
||||
qmailsend_cont()
|
||||
{
|
||||
if ! statusmsg=`run_rc_command status`; then
|
||||
@ECHO@ $statusmsg
|
||||
return 1
|
||||
fi
|
||||
@ECHO@ "Continuing ${name}."
|
||||
kill -CONT $rc_pid
|
||||
}
|
||||
|
||||
qmailsend_doqueue()
|
||||
{
|
||||
if ! statusmsg=`run_rc_command status`; then
|
||||
@ECHO@ $statusmsg
|
||||
return 1
|
||||
fi
|
||||
@ECHO@ "Flushing timeout table and sending ALRM signal to qmail-send."
|
||||
@LOCALBASE@/bin/qmail-tcpok
|
||||
kill -ALRM $rc_pid
|
||||
}
|
||||
|
||||
qmailsend_queue()
|
||||
{
|
||||
@LOCALBASE@/bin/qmail-qstat
|
||||
@LOCALBASE@/bin/qmail-qread
|
||||
}
|
||||
|
||||
qmailsend_hup()
|
||||
{
|
||||
run_rc_command reload
|
||||
}
|
||||
|
||||
load_rc_config $name
|
||||
run_rc_command "$1"
|
80
mail/qmail-run/files/qmailsmtpd.sh
Normal file
80
mail/qmail-run/files/qmailsmtpd.sh
Normal file
|
@ -0,0 +1,80 @@
|
|||
#!@RCD_SCRIPTS_SHELL@
|
||||
#
|
||||
# $NetBSD: qmailsmtpd.sh,v 1.1.1.1 2004/08/02 03:59:21 schmonz Exp $
|
||||
#
|
||||
# Script to control qmail-smtpd (SMTP service).
|
||||
#
|
||||
|
||||
# PROVIDE: qmailsmtpd mail
|
||||
# REQUIRE: qmailsend
|
||||
|
||||
. /etc/rc.subr
|
||||
|
||||
name="qmailsmtpd"
|
||||
rcvar=${name}
|
||||
required_files="@PKG_SYSCONFDIR@/control/concurrencyincoming"
|
||||
required_files="${required_files} @PKG_SYSCONFDIR@/tcp.smtp.cdb"
|
||||
required_files="${required_files} @PKG_SYSCONFDIR@/control/rcpthosts"
|
||||
command="@LOCALBASE@/bin/tcpserver"
|
||||
procname=${name}
|
||||
start_precmd="qmailsmtpd_precmd"
|
||||
extra_commands="stat pause cont cdb"
|
||||
stat_cmd="qmailsmtpd_stat"
|
||||
pause_cmd="qmailsmtpd_pause"
|
||||
cont_cmd="qmailsmtpd_cont"
|
||||
cdb_cmd="qmailsmtpd_cdb"
|
||||
|
||||
# User-settable rc.conf variables and their default values:
|
||||
qmailsmtpd_postenv=${qmailsmtpd_postenv-"QMAILQUEUE=@LOCALBASE@/bin/qmail-queue"}
|
||||
qmailsmtpd_tcpflags=${qmailsmtpd_tcpflags-"-v -R -l 0"}
|
||||
qmailsmtpd_tcphost=${qmailsmtpd_tcphost-"0"}
|
||||
qmailsmtpd_tcpport=${qmailsmtpd_tcpport-"25"}
|
||||
qmailsmtpd_datalimit=${qmailsmtpd_datalimit-"2000000"}
|
||||
qmailsmtpd_pretcpserver=${qmailsmtpd_pretcpserver-""}
|
||||
qmailsmtpd_presmtpd=${qmailsmtpd_presmtpd-""}
|
||||
qmailsmtpd_logcmd=${qmailsmtpd_logcmd-"@LOCALBASE@/bin/setuidgid qmaill @LOCALBASE@/bin/splogger nb${name}"}
|
||||
|
||||
qmailsmtpd_precmd()
|
||||
{
|
||||
# tcpserver(1) is akin to inetd(8), but runs one service per process.
|
||||
# We want to signal only the tcpserver process responsible for SMTP
|
||||
# service. Use argv0(1) to set procname to "qmailsmtpd".
|
||||
command="@SETENV@ - ${qmailsmtpd_postenv} @LOCALBASE@/bin/softlimit -m ${qmailsmtpd_datalimit} ${qmailsmtpd_pretcpserver} @LOCALBASE@/bin/argv0 @LOCALBASE@/bin/tcpserver ${name} ${qmailsmtpd_tcpflags} -x @PKG_SYSCONFDIR@/tcp.smtp.cdb -c `@HEAD@ -1 @PKG_SYSCONFDIR@/control/concurrencyincoming` -u `@ID@ -u qmaild` -g `@ID@ -g qmaild` ${qmailsmtpd_tcphost} ${qmailsmtpd_tcpport} ${qmailsmtpd_presmtpd} @LOCALBASE@/bin/qmail-smtpd 2>&1 | ${qmailsmtpd_logcmd}"
|
||||
command_args="&"
|
||||
rc_flags=""
|
||||
}
|
||||
|
||||
qmailsmtpd_stat()
|
||||
{
|
||||
run_rc_command status
|
||||
}
|
||||
|
||||
qmailsmtpd_pause()
|
||||
{
|
||||
if ! statusmsg=`run_rc_command status`; then
|
||||
@ECHO@ $statusmsg
|
||||
return 1
|
||||
fi
|
||||
@ECHO@ "Pausing ${name}."
|
||||
kill -STOP $rc_pid
|
||||
}
|
||||
|
||||
qmailsmtpd_cont()
|
||||
{
|
||||
if ! statusmsg=`run_rc_command status`; then
|
||||
@ECHO@ $statusmsg
|
||||
return 1
|
||||
fi
|
||||
@ECHO@ "Continuing ${name}."
|
||||
kill -CONT $rc_pid
|
||||
}
|
||||
|
||||
qmailsmtpd_cdb()
|
||||
{
|
||||
echo "Reloading @PKG_SYSCONFDIR@/tcp.smtp."
|
||||
@LOCALBASE@/bin/tcprules @PKG_SYSCONFDIR@/tcp.smtp.cdb @PKG_SYSCONFDIR@/tcp.smtp.tmp < @PKG_SYSCONFDIR@/tcp.smtp
|
||||
@CHMOD@ 644 @PKG_SYSCONFDIR@/tcp.smtp.cdb
|
||||
}
|
||||
|
||||
load_rc_config $name
|
||||
run_rc_command "$1"
|
Loading…
Reference in a new issue