From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.sysutils.supervision.general/1317 Path: news.gmane.org!not-for-mail From: "George Georgalis" Newsgroups: gmane.comp.sysutils.supervision.general Subject: Re: Filtering socklog output revisited Date: Sat, 11 Nov 2006 15:42:49 -0500 Message-ID: <20061111204249.GA26799@run.galis.org> References: <20060828054124.GB12147@home.power> <20060830011813.GB6449@home.power> <20060830012814.GK3979@run.galis.org> <20060830024505.GC6449@home.power> <20060830031052.GA3462@skarnet.org> <20060830144632.GM3979@run.galis.org> <20060901151604.GE10960@run.galis.org> <20060901175137.GA28256@odin.dempsky.org> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1163277782 24784 80.91.229.2 (11 Nov 2006 20:43:02 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 11 Nov 2006 20:43:02 +0000 (UTC) Original-X-From: supervision-return-1553-gcsg-supervision=m.gmane.org@list.skarnet.org Sat Nov 11 21:42:59 2006 Return-path: Envelope-to: gcsg-supervision@gmane.org Original-Received: from antah.skarnet.org ([212.85.147.14]) by ciao.gmane.org with smtp (Exim 4.43) id 1Gizgi-0001Xc-T7 for gcsg-supervision@gmane.org; Sat, 11 Nov 2006 21:42:53 +0100 Original-Received: (qmail 8717 invoked by uid 76); 11 Nov 2006 20:43:13 -0000 Mailing-List: contact supervision-help@list.skarnet.org; run by ezmlm List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Archive: Original-Received: (qmail 8712 invoked from network); 11 Nov 2006 20:43:12 -0000 Original-To: supervision@list.skarnet.org Mail-Followup-To: supervision@list.skarnet.org Content-Disposition: inline In-Reply-To: <20060901175137.GA28256@odin.dempsky.org> Xref: news.gmane.org gmane.comp.sysutils.supervision.general:1317 Archived-At: On Fri, Sep 01, 2006 at 12:51:37PM -0500, Matthew R. Dempsky wrote: >On Fri, Sep 01, 2006 at 11:16:04AM -0400, George Georgalis wrote: >> Seems like a good c program, read input from an arbitrary fd >> specified as a command line switch and pipe to stdout (where >> it can be directed to an arbitrary fd, with the shell). > >This sounds like a job for multitee[1]. > >[1] http://code.dogmap.org/fdtools/multitee/ even with multitee, I need some help. :-{ Here's the goal, writing a qmail-queue replacement, which will conditionally call qmail-queue and possibly alter the fd1 it receives. To test the filter, I'm doing the following: * verify $a gets set set correctly in the test by first setting it to "null". * spawn a sub-shell to contain all fd * generate qmail-queue type expected input: 'message\n' to fd0 and 'envelope\x00' to fd1 (I do this by outputting them to fd1 and fd2 because I expect the target program will attach those to fd0 and fd1) * pipe output to a separate process (sub-shell) * in the target process, capture fd0 and fd1 so they can be filtered and attached to qmail-queue Trying multitee, after many failed attempts, I got to a='null'; (printf "message\n"; printf "envelope\x00" >&2) | (cat >/dev/null; a="n$(multitee 1,0)"; printf "@$a\n") I expected this output "n@envelope\x00\n" but when it didn't work I began to wonder if I needed multitee at all... a='null'; (printf "message\n"; printf "envelope\x00" >&2) | (cat >/dev/null; a="n$(exec 1>&0; cat)"; printf "@$a\n") but what I actually get is "envlope@n\n", so what's wrong here? (and what's happening?) // George -- George Georgalis, systems architect, administrator <