Fri Aug 4 06:35:28 2017 UTC ()
If there's more than one qmail-send running (e.g., /var/qmail2 running
from /service), the rc.d script can't tell which is ours. Make and use
a pidfile.

(The other rc.d scripts set argv[0] to names that are unlikely to
collide, but there's no easy way to do that for the qmail-send process
exec'd by qmail-start.)

Bump PKGREVISION.


(schmonz)
diff -r1.41 -r1.42 pkgsrc/mail/qmail-run/Makefile
diff -r1.10 -r1.11 pkgsrc/mail/qmail-run/files/qmailsend.sh

cvs diff -r1.41 -r1.42 pkgsrc/mail/qmail-run/Makefile (expand / switch to unified diff)

--- pkgsrc/mail/qmail-run/Makefile 2017/07/30 03:05:58 1.41
+++ pkgsrc/mail/qmail-run/Makefile 2017/08/04 06:35:28 1.42
@@ -1,17 +1,17 @@ @@ -1,17 +1,17 @@
1# $NetBSD: Makefile,v 1.41 2017/07/30 03:05:58 schmonz Exp $ 1# $NetBSD: Makefile,v 1.42 2017/08/04 06:35:28 schmonz Exp $
2# 2#
3 3
4DISTNAME= qmail-run-20170729 4DISTNAME= qmail-run-20170804
5CATEGORIES= mail 5CATEGORIES= mail
6MASTER_SITES= # empty 6MASTER_SITES= # empty
7DISTFILES= # empty 7DISTFILES= # empty
8 8
9MAINTAINER= schmonz@NetBSD.org 9MAINTAINER= schmonz@NetBSD.org
10COMMENT= Configures qmail to receive and deliver mail 10COMMENT= Configures qmail to receive and deliver mail
11LICENSE= 2-clause-bsd 11LICENSE= 2-clause-bsd
12 12
13DEPENDS+= mess822-[0-9]*:../../mail/mess822 13DEPENDS+= mess822-[0-9]*:../../mail/mess822
14DEPENDS_QMAIL= qmail>=1.03nb29:../../mail/qmail 14DEPENDS_QMAIL= qmail>=1.03nb29:../../mail/qmail
15DEPENDS+= ${DEPENDS_QMAIL} 15DEPENDS+= ${DEPENDS_QMAIL}
16DEPENDS+= qmail-qfilter>1.5nb1:../../mail/qmail-qfilter 16DEPENDS+= qmail-qfilter>1.5nb1:../../mail/qmail-qfilter
17 17

cvs diff -r1.10 -r1.11 pkgsrc/mail/qmail-run/files/qmailsend.sh (expand / switch to unified diff)

--- pkgsrc/mail/qmail-run/files/qmailsend.sh 2017/06/17 05:58:39 1.10
+++ pkgsrc/mail/qmail-run/files/qmailsend.sh 2017/08/04 06:35:28 1.11
@@ -1,66 +1,79 @@ @@ -1,66 +1,79 @@
1#!@RCD_SCRIPTS_SHELL@ 1#!@RCD_SCRIPTS_SHELL@
2# 2#
3# $NetBSD: qmailsend.sh,v 1.10 2017/06/17 05:58:39 schmonz Exp $ 3# $NetBSD: qmailsend.sh,v 1.11 2017/08/04 06:35:28 schmonz Exp $
4# 4#
5# @PKGNAME@ script to control qmail-send (local and outgoing mail). 5# @PKGNAME@ script to control qmail-send (local and outgoing mail).
6# 6#
7 7
8# PROVIDE: qmailsend mail 8# PROVIDE: qmailsend mail
9# REQUIRE: LOGIN 9# REQUIRE: LOGIN
10# KEYWORD: shutdown 10# KEYWORD: shutdown
11 11
12name="qmailsend" 12name="qmailsend"
13 13
14# User-settable rc.conf variables and their default values: 14# User-settable rc.conf variables and their default values:
15: ${qmailsend_postenv:="PATH=@PREFIX@/bin:$PATH"} 15: ${qmailsend_postenv:="PATH=@PREFIX@/bin:$PATH"}
16: ${qmailsend_defaultdelivery:="`@HEAD@ -1 @PKG_SYSCONFDIR@/control/defaultdelivery`"} 16: ${qmailsend_defaultdelivery:="`@HEAD@ -1 @PKG_SYSCONFDIR@/control/defaultdelivery`"}
17: ${qmailsend_log:="YES"} 17: ${qmailsend_log:="YES"}
18: ${qmailsend_logcmd:="logger -t nb${name} -p mail.info"} 18: ${qmailsend_logcmd:="logger -t nb${name} -p mail.info"}
19: ${qmailsend_nologcmd:="@PREFIX@/bin/multilog -*"} 19: ${qmailsend_nologcmd:="@PREFIX@/bin/multilog -*"}
20 20
21if [ -f /etc/rc.subr ]; then 21if [ -f /etc/rc.subr ]; then
22 . /etc/rc.subr 22 . /etc/rc.subr
23fi 23fi
24 24
25rcvar=${name} 25rcvar=${name}
26required_files="@PKG_SYSCONFDIR@/control/defaultdelivery" 26required_files="@PKG_SYSCONFDIR@/control/defaultdelivery"
27required_files="${required_files} @PKG_SYSCONFDIR@/control/me" 27required_files="${required_files} @PKG_SYSCONFDIR@/control/me"
28command="@PREFIX@/bin/qmail-send" 28command="@PREFIX@/bin/qmail-send"
29start_precmd="qmailsend_precmd" 29start_precmd="qmailsend_prestart"
 30start_postcmd="qmailsend_poststart"
 31stop_postcmd="qmailsend_poststop"
 32pidfile="@VARBASE@/run/${name}.pid"
30extra_commands="stat pause cont doqueue reload queue alrm flush hup" 33extra_commands="stat pause cont doqueue reload queue alrm flush hup"
31stat_cmd="qmailsend_stat" 34stat_cmd="qmailsend_stat"
32pause_cmd="qmailsend_pause" 35pause_cmd="qmailsend_pause"
33cont_cmd="qmailsend_cont" 36cont_cmd="qmailsend_cont"
34doqueue_cmd="qmailsend_doqueue" 37doqueue_cmd="qmailsend_doqueue"
35queue_cmd="qmailsend_queue" 38queue_cmd="qmailsend_queue"
36alrm_cmd="qmailsend_doqueue" 39alrm_cmd="qmailsend_doqueue"
37flush_cmd="qmailsend_doqueue" 40flush_cmd="qmailsend_doqueue"
38hup_cmd="qmailsend_hup" 41hup_cmd="qmailsend_hup"
39 42
40qmailsend_precmd() 43qmailsend_prestart()
41{ 44{
42 # qmail-start(8) starts the various qmail processes, then exits. 45 # qmail-start(8) starts the various qmail processes, then exits.
43 # qmail-send(8) is the process we want to signal later. 46 # qmail-send(8) is the process we want to signal later.
44 if [ -f /etc/rc.subr ] && ! checkyesno qmailsend_log; then 47 if [ -f /etc/rc.subr ] && ! checkyesno qmailsend_log; then
45 qmailsend_logcmd=${qmailsend_nologcmd} 48 qmailsend_logcmd=${qmailsend_nologcmd}
46 fi 49 fi
47 command="@PREFIX@/bin/pgrphack @SETENV@ - ${qmailsend_postenv} 50 command="@PREFIX@/bin/pgrphack @SETENV@ - ${qmailsend_postenv}
48qmail-start '$qmailsend_defaultdelivery' 51qmail-start '$qmailsend_defaultdelivery'
49${qmailsend_logcmd}" 52${qmailsend_logcmd}"
50 command_args="&" 53 command_args="&"
51 rc_flags="" 54 rc_flags=""
52} 55}
53 56
 57qmailsend_poststart()
 58{
 59 echo $! > ${pidfile}
 60}
 61
 62qmailsend_poststop()
 63{
 64 rm -f ${pidfile}
 65}
 66
54qmailsend_stat() 67qmailsend_stat()
55{ 68{
56 run_rc_command status 69 run_rc_command status
57} 70}
58 71
59qmailsend_pause() 72qmailsend_pause()
60{ 73{
61 if ! statusmsg=`run_rc_command status`; then 74 if ! statusmsg=`run_rc_command status`; then
62 @ECHO@ $statusmsg 75 @ECHO@ $statusmsg
63 return 1 76 return 1
64 fi 77 fi
65 @ECHO@ "Pausing ${name}." 78 @ECHO@ "Pausing ${name}."
66 kill -STOP $rc_pid 79 kill -STOP $rc_pid
@@ -93,16 +106,17 @@ qmailsend_queue() @@ -93,16 +106,17 @@ qmailsend_queue()
93 @PREFIX@/bin/qmail-qread 106 @PREFIX@/bin/qmail-qread
94} 107}
95 108
96qmailsend_hup() 109qmailsend_hup()
97{ 110{
98 run_rc_command reload 111 run_rc_command reload
99} 112}
100 113
101if [ -f /etc/rc.subr ]; then 114if [ -f /etc/rc.subr ]; then
102 load_rc_config $name 115 load_rc_config $name
103 run_rc_command "$1" 116 run_rc_command "$1"
104else 117else
105 @ECHO_N@ " ${name}" 118 @ECHO_N@ " ${name}"
106 qmailsend_precmd 119 qmailsend_prestart
107 eval ${command} ${qmailsend_flags} ${command_args} 120 eval ${command} ${qmailsend_flags} ${command_args}
 121 qmailsend_poststart
108fi 122fi