supervision - discussion about system services, daemon supervision, init, runlevel management, and tools such as s6 and runit
 help / color / mirror / Atom feed
From: "George Georgalis" <george@galis.org>
Subject: Re: Filtering socklog output revisited
Date: Sat, 11 Nov 2006 15:42:49 -0500	[thread overview]
Message-ID: <20061111204249.GA26799@run.galis.org> (raw)
In-Reply-To: <20060901175137.GA28256@odin.dempsky.org>

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 <IXOYE><


  parent reply	other threads:[~2006-11-11 20:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <loom.20060827T200142-606@post.gmane.org>
     [not found] ` <20060828054124.GB12147@home.power>
     [not found]   ` <loom.20060830T004327-914@post.gmane.org>
     [not found]     ` <20060830011813.GB6449@home.power>
     [not found]       ` <20060830012814.GK3979@run.galis.org>
     [not found]         ` <20060830024505.GC6449@home.power>
     [not found]           ` <20060830031052.GA3462@skarnet.org>
     [not found]             ` <20060830144632.GM3979@run.galis.org>
2006-09-01 15:16               ` George Georgalis
2006-09-01 17:51                 ` Matthew R. Dempsky
2006-09-02  2:27                   ` George Georgalis
2006-11-11 20:42                   ` George Georgalis [this message]
2006-11-12  5:36                     ` George Georgalis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20061111204249.GA26799@run.galis.org \
    --to=george@galis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).