From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.sysutils.supervision.general/762 Path: news.gmane.org!not-for-mail From: Henrik Heil Newsgroups: gmane.comp.sysutils.supervision.general Subject: OT: svlogd-logprocessor with bash/multitee Date: Wed, 13 Apr 2005 15:58:37 +0200 Message-ID: <425D258D.9010708@zweipol.net> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1113400780 24635 80.91.229.2 (13 Apr 2005 13:59:40 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 13 Apr 2005 13:59:40 +0000 (UTC) Original-X-From: supervision-return-998-gcsg-supervision=m.gmane.org@list.skarnet.org Wed Apr 13 15:59:29 2005 Return-path: Original-Received: from antah.skarnet.org ([212.85.147.14]) by ciao.gmane.org with smtp (Exim 4.43) id 1DLiLl-0006NO-1f for gcsg-supervision@gmane.org; Wed, 13 Apr 2005 15:56:13 +0200 Original-Received: (qmail 32274 invoked by uid 76); 13 Apr 2005 13:59:47 -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 32268 invoked from network); 13 Apr 2005 13:59:47 -0000 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7) Gecko/20040616 Thunderbird/0.7 Mnenhy/0.6.0.101 X-Accept-Language: en-us, en Original-To: supervision@list.skarnet.org Xref: news.gmane.org gmane.comp.sysutils.supervision.general:762 X-Report-Spam: http://spam.gmane.org/gmane.comp.sysutils.supervision.general:762 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/