summaryrefslogtreecommitdiff
path: root/sys/man/8/qer
blob: 0dba5e023915c9fc0efd810942bf743965e8650a (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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
.TH QER 8 
.SH NAME
qer, runq \- queue management for spooled files
.SH SYNOPSIS
.B qer
[
.B -q
.I subdir
]
[
.B -f
.I file
]
.I root tag reply args
.br
.B runq
[
.B -adsER
]
[
.B -f
.I file
]
[
.B -q
.I subdir
]
[
.B -l
.I load
]
[
.B -t
.I time
]
[
.B -r
.I nfiles
]
[
.B -n
.I nprocs
]
.I root cmd
.SH DESCRIPTION
.I Qer
creates a control and a data file in a queue directory.
The control file contents consist of the
.IR tag ,
.IR reply ,
and
.I args
separated by spaces.
The data file contains the standard input to
.IR qer .
The files are created in the directory
.IR root / subdir ,
where
.I subdir
is the argument to
.B -q
if present, else the contents of
.BR /dev/user .
The names of the control and data files differ only
in the first character which is `C' and `D' respectively.
.IR Mktemp (2)
is used to create the actual names of the control and
data file.
.P
Some commands, such as
.I fax
(see
.IR telco (4)),
must queue more files than just the data file.
Each
.I file
following a
.B \-f
flag is copied into the queue directory.  The names
of the copies differ from the name of the data file
only in the first character.  The first one is
starts with 'F', the second 'G', etc.
.P
.I Runq
processes the files queued by
.IR qer .
Without the
.B -a
option,
.I runq
processes all requests in the directory
.IR root / subdir ,
where
.I subdir
is the argument to
.B -q
if present, else the contents of
.BR /dev/user .
With the
.B -a
it processes all requests.
Each request is processed by executing the command
.I cmd
with the contents of the control file as its arguments,
the contents of the data file as its standard input, and
standard error appended to the error file
.BR E.XXXXXX .
.P
The action taken by
.I runq
depends on the return status of
.IR cmd .
If
.I cmd
returns a null status, the processing is assumed successful and the
control, data, and error files are removed.
If
.I cmd
returns an error status containing the word
.LR Retry ,
the files are left to be reprocessed at a later time.
For any other status, an error message is mailed
to the requester and the files are removed.
.I Runq
uses the
.I reply
field in the control file as
a mail address to which to send an error notification.
The notification contains the contents of the control
file to identify the failed request.
.P
To avoid reprocessing files too often, the following algorithm is used:
a data file younger than one hour will not be processed if its
error file exists and was last modified within the preceding 10 minutes.
A data file older than one hour will not be processed if its error
file exists and was last modified within the preceding hour.
The 
.B -E
flag causes all files to be reprocessed regardless of
the file times.
.P
The
.B -R
flag instructs
.I runq
never to give up on a failed queue job, instead leaving
it in the queue to be retried.
.P
The
.B -d
option causes debugging output on standard error
describing the progress through the queues.
.P
The
.B -t
flags specifies the number of hours
that retries will continue after a send
failure.  The default is 48 hours.
.P
The
.BR -r
flag limits the number of files that are processed in a single pass of a queue.
.I Runq
accumulates the entire directory containing a queue before processing any
files.  When a queue contains many files and the system does not
have enough memory,
.I runq
exits without making progress.  This flag forces
.I runq
to process the directory in chunks, allowing the queue to
be drained incrementally.  It is most useful in combination with the
.I -q
flag.
.P
The
.BR -s ,
.BR -n ,
and
.B -l
flags are only meaningful with the
.B -a
flag.  They control amount of parallelism that
is used when sweeping all of the queues.  The argument following the
.B -n
flag specifies the number of queues that are swept
in parallel; the default is 50.  The argument following the
.B -l
flag specifies the total number of queues that are being swept.
By default, there is no limit.  The number of active sweeps
is cumulative over all active executions of
.IR runq .
The
.B -s
flag forces each queue directory to be processed by exactly
one instance of
.IR runq .
This is useful on systems that connect to slow
external systems and prevents all the queue sweeps from
piling up trying to process a few slow systems.
.PP
.I Runq
is often called from
.IR cron (8)
by an entry such as
.IP
.EX
0,10,20,30,40,50 * * * * kremvax
        runq -a /mail/queue /mail/lib/remotemail
.EE
.LP
The entry must be a single line; it is folded here only so it fits on the page.
.SH FILES
.TF \fIroot\fP/\fIuser\fP/[F-Z].XXXXXX
.TP
.B \fIroot\fP/\fIuser\fP
queue directory for
.I user
.TP
.B \fIroot\fP/\fIuser\fP/D.XXXXXX
data file
.TP
.B \fIroot\fP/\fIuser\fP/C.XXXXXX
control file
.TP
.B \fIroot\fP/\fIuser\fP/E.XXXXXX
error file
.TP
.B \fIroot\fP/\fIuser\fP/[F-Z].XXXXXX
secondary data files
.SH SOURCE
.B /sys/src/cmd/upas/q
.SH "SEE ALSO"
.IR mail (1)