blob: 07e8ee2e2634fa28a807a1f4e9efecc3d6d1ba3c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
#!@RCD_SCRIPTS_SHELL@
#
# $NetBSD: qmailsend.sh,v 1.18 2020/05/19 19:45:58 schmonz Exp $
#
# @PKGNAME@ script to control qmail-send (local and outgoing mail).
#
# PROVIDE: qmailsend mail
# REQUIRE: LOGIN
# KEYWORD: shutdown
name="qmailsend"
# User-settable rc.conf variables and their default values:
: ${qmailsend_postenv:="QMAILREMOTE=@PREFIX@/bin/qmail-remote"}
: ${qmailsend_datalimit:="540000000"}
: ${qmailsend_defaultdelivery:="`@HEAD@ -1 @PKG_SYSCONFDIR@/control/defaultdelivery`"}
: ${qmailsend_log:="YES"}
: ${qmailsend_logcmd:="logger -t nbqmail/send -p mail.info"}
: ${qmailsend_nologcmd:="@PREFIX@/bin/multilog -*"}
if [ -f /etc/rc.subr ]; then
. /etc/rc.subr
fi
rcvar=${name}
required_files="@PKG_SYSCONFDIR@/control/defaultdelivery"
required_files="${required_files} @PKG_SYSCONFDIR@/control/me"
command="@PREFIX@/bin/qmail-send"
start_precmd="qmailsend_prestart"
start_postcmd="qmailsend_poststart"
stop_postcmd="qmailsend_poststop"
pidfile="@VARBASE@/run/${name}.pid"
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"
qmailsend_prestart() {
if [ -f /etc/rc.subr ] && ! checkyesno qmailsend_log; then
qmailsend_logcmd=${qmailsend_nologcmd}
fi
@MKDIR@ "@VARBASE@/run"
# qmail-start(8) starts the various qmail processes, then execs
# qmail-send(8). That's the process we want to signal later.
command="@PREFIX@/bin/pgrphack @SETENV@ - PATH=@PREFIX@/bin:$PATH ${qmailsend_postenv} \
@PREFIX@/bin/softlimit -m ${qmailsend_datalimit} \
qmail-start '$qmailsend_defaultdelivery' \
${qmailsend_logcmd}"
command_args="&"
rc_flags=""
}
qmailsend_poststart() {
echo $! > ${pidfile}
}
qmailsend_poststop() {
rm -f ${pidfile}
}
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."
@PREFIX@/bin/qmail-tcpok
kill -ALRM $rc_pid
}
qmailsend_queue() {
@PREFIX@/bin/qmail-qstat
@PREFIX@/bin/qmail-qread
}
qmailsend_hup() {
run_rc_command reload
}
if [ -f /etc/rc.subr ]; then
load_rc_config $name
run_rc_command "$1"
else
@ECHO_N@ " ${name}"
qmailsend_prestart
eval ${command} ${qmailsend_flags} ${command_args}
qmailsend_poststart
fi
|