This is in reference to:

http://www.ornl.gov/its/archives/mailing-lists/qmail/1998/12/msg01046.html
and
http://www.ornl.gov/its/archives/mailing-lists/qmail/2000/07/msg01597.html

I am finally going to stop using syslog and instead pipe to multilog to
keep my mail logs.  However I'm having a problem with I/O re-direction
and I'm not certain whether this is a shell issue, or a tcpserver or
recordio issue.

Fwiw I am running into the same problem on both Debian 2.2 and OpenBSD
2.8 systems.  My shell is bash on both of them, but if I use /bin/sh
(aka pdksh) on OBSD I get the same result.  I have the feeling this
amounts to something I am missing regarding I/O redirection and I am
looking for advice.  :)

I have a script 'qmail-smtpd' which looks like this:

exec /usr/local/bin/tcpserver -x /usr/local/etc/tcp.smtp.cdb -R -u 1002 -g \
1001 0 25 /var/qmail/bin/qmail-smtpd > /dev/null &

I would like to pipe tcpserver's output through some text processor
(such as grep or awk) using recordio, like this:

exec /usr/local/bin/tcpserver -x /usr/local/etc/tcp.smtp.cdb -R -u 1002 -g \
1001 0 25 recordio /var/qmail/bin/qmail-smtpd | awk '{if ($2 != "<") print}' \
 | multilog /var/log/smtpd

as described in DJB's example on the above-referenced list message.

However, when I do so, I get NO output into the logs at all.  Well, after
lots of playing around with re-direction characters and wasting lots of
time, I think I can simplify my question this way:

Why does this work (i.e., produce output in /var/log/smtpd/current):

exec /usr/local/bin/tcpserver -x /usr/local/etc/tcp.smtp.cdb -R -u 1002
-g 1001 0 25 recordio /var/qmail/bin/qmail-smtpd 2>&1 | cat | multilog
/var/log/smtpd

but not this (i.e., this produces no output in /var/log/smtpd/current):

exec /usr/local/bin/tcpserver -x /usr/local/etc/tcp.smtp.cdb -R -u 1002
-g 1001 0 25 recordio /var/qmail/bin/qmail-smtpd 2>&1 | cat -n | multilog
/var/log/smtpd

Of course I'm not planning on using 'cat' in reality but something
strange is occurring here where if I specify arguments to cat (or any
other program), I end up with no output.  Anyone know the reason for this,
and what I am doing wrong?  I think once I figure that out I'll be able
to get awk or grep or whatever to work as well.

Thanks.

Reply via email to