supervision - discussion about system services, daemon supervision, init, runlevel management, and tools such as s6 and runit
 help / color / mirror / Atom feed
From: Henrik Heil <hhml@zweipol.net>
Subject: OT: svlogd-logprocessor with bash/multitee
Date: Wed, 13 Apr 2005 15:58:37 +0200	[thread overview]
Message-ID: <425D258D.9010708@zweipol.net> (raw)

Hello list,

this is OT but i encountered this problem when i tried to write a 
socklog svlogd-processor that does the following:

- copy stdin to stdout (unaltered)
- pipe stdin through a programm that mails a report
- pipe stdin through a second programm that writes some html statistics

I'm not too familiar with doing descriptor-manipulation in shell-scripts 
but i think it cannot be done with pure sh (or bash in this case) so i 
tried to do this with bash & djbs multitee.

To keep my test simple i use sed to emulate the report-programms.
The closest i got was to make it work with one programm:

--- 8< ---

# cat logproc.sh

#!/bin/sh
exec 6>&1
/usr/bin/multitee 0:6 0:7 \
7>&1 | sed s/test_stdin/test_fd7/

# echo test_stdin | ./logproc.sh

test_stdin
test_fd7

--- >8 ---


Now with 2 programms:

--- 8< ---

# cat logproc.sh

#!/bin/sh
exec 6>&1
/usr/bin/multitee 0:6 0:7 0:8 \
7>&1 | sed s/test_stdin/test_fd7/ \
8>&1 | sed s/test_stdin/test_fd8/

# echo test_stdin | ./logproc.sh

test_stdin
[...programm does not return]

--- >8 ---

I assume it's just my lacking shell-programming skills ;-).
Allthough I wasn't lucky googling for an answer i think it's no too 
uncommon to want something like this in a logprocessor.

Maybe someone has done that before.
Any help is appreciated.

Thanks,
Henrik

-- 
Henrik Heil, zweipol Coy & Heil GbR
http://www.zweipol.net/


             reply	other threads:[~2005-04-13 13:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-13 13:58 Henrik Heil [this message]
2005-04-13 16:50 ` Paul Jarc

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=425D258D.9010708@zweipol.net \
    --to=hhml@zweipol.net \
    /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).