supervision - discussion about system services, daemon supervision, init, runlevel management, and tools such as s6 and runit
 help / color / mirror / Atom feed
* Re: Filtering socklog output revisited
       [not found]             ` <20060830144632.GM3979@run.galis.org>
@ 2006-09-01 15:16               ` George Georgalis
  2006-09-01 17:51                 ` Matthew R. Dempsky
  0 siblings, 1 reply; 5+ messages in thread
From: George Georgalis @ 2006-09-01 15:16 UTC (permalink / raw)


On Wed, Aug 30, 2006 at 10:46:32AM -0400, George Georgalis wrote:
>On Wed, Aug 30, 2006 at 05:10:52AM +0200, Laurent Bercot wrote:
>> Why, what you need here is execline. :)
>> http://www.skarnet.org/software/execline/pipeline.html
>
>That looks pretty interesting.
>
>How would you use it to read (and conditionally process) fd1
>within a program (wrapper) that also reads fd0 and does a
>conditional exec with a fd0 and fd1 hand-off to a secondary
>program (qmail-queue)?

I don't see any way (with redirection) to use pipeline to manage
fd1 input within a script that already uses fd0 input.

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). 

Seems all the shell redirection methods for "input" work on a
file.  Or, is there a technique I'm missing?

// George


-- 
George Georgalis, systems architect, administrator <IXOYE><


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Filtering socklog output revisited
  2006-09-01 15:16               ` Filtering socklog output revisited George Georgalis
@ 2006-09-01 17:51                 ` Matthew R. Dempsky
  2006-09-02  2:27                   ` George Georgalis
  2006-11-11 20:42                   ` George Georgalis
  0 siblings, 2 replies; 5+ messages in thread
From: Matthew R. Dempsky @ 2006-09-01 17:51 UTC (permalink / raw)


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/


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Filtering socklog output revisited
  2006-09-01 17:51                 ` Matthew R. Dempsky
@ 2006-09-02  2:27                   ` George Georgalis
  2006-11-11 20:42                   ` George Georgalis
  1 sibling, 0 replies; 5+ messages in thread
From: George Georgalis @ 2006-09-02  2:27 UTC (permalink / raw)


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

precisely, and at 2000+ lines, at least I don't think I'm an idiot
for thinking "this is a difficult task," anymore. 15 years ago I
didn't know there was a Usenet. wonder why djb doesn't link to it?
(Thanks Paul).

// George


-- 
George Georgalis, systems architect, administrator <IXOYE><


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Filtering socklog output revisited
  2006-09-01 17:51                 ` Matthew R. Dempsky
  2006-09-02  2:27                   ` George Georgalis
@ 2006-11-11 20:42                   ` George Georgalis
  2006-11-12  5:36                     ` George Georgalis
  1 sibling, 1 reply; 5+ messages in thread
From: George Georgalis @ 2006-11-11 20:42 UTC (permalink / raw)


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Filtering socklog output revisited
  2006-11-11 20:42                   ` George Georgalis
@ 2006-11-12  5:36                     ` George Georgalis
  0 siblings, 0 replies; 5+ messages in thread
From: George Georgalis @ 2006-11-12  5:36 UTC (permalink / raw)


On Sat, Nov 11, 2006 at 03:42:49PM -0500, George Georgalis wrote:
>Here's the goal, writing a qmail-queue replacement, which will
>conditionally call qmail-queue and possibly alter the fd1 it
>receives.

nevermind, http://galis.org/script/prequeue
I got it.

// George


-- 
George Georgalis, systems architect, administrator <IXOYE><


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-11-12  5:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [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               ` Filtering socklog output revisited George Georgalis
2006-09-01 17:51                 ` Matthew R. Dempsky
2006-09-02  2:27                   ` George Georgalis
2006-11-11 20:42                   ` George Georgalis
2006-11-12  5:36                     ` George Georgalis

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).