From owner-freebsd-questions Thu Feb 21 4:50: 0 2002 Delivered-To: freebsd-questions@freebsd.org Received: from post.mail.nl.demon.net (post-11.mail.nl.demon.net [194.159.73.21]) by hub.freebsd.org (Postfix) with ESMTP id 83BDD37B405 for ; Thu, 21 Feb 2002 04:49:55 -0800 (PST) Received: from [212.238.194.207] (helo=mailhost.raggedclown.net) by post.mail.nl.demon.net with esmtp (Exim 3.33 #1) id 16dsfa-0004Iq-00 for freebsd-questions@freebsd.org; Thu, 21 Feb 2002 12:49:54 +0000 Received: from angel.raggedclown.net (angel.raggedclown.intra [192.168.1.7]) by mailhost.raggedclown.net (Ragged Clown Mail Gateway [buffy]) with ESMTP id E91D213040 for ; Thu, 21 Feb 2002 13:49:52 +0100 (CET) Received: by angel.raggedclown.net (Ragged Clown Host [angel], from userid 1005) id E2A5F22590; Thu, 21 Feb 2002 13:49:52 +0100 (CET) Date: Thu, 21 Feb 2002 13:49:52 +0100 From: Cliff Sarginson To: freebsd-questions@FreeBSD.ORG Subject: Re: syslog.conf problems Message-ID: <20020221124952.GC6462@raggedclown.net> References: <20020221030958.QQRM18863.femail11.sdc1.sfba.home.com@there> <20020221191235.C22670@grimoire.chen.org.nz> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20020221191235.C22670@grimoire.chen.org.nz> User-Agent: Mutt/1.3.27i Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Thu, Feb 21, 2002 at 07:12:35PM +1300, Jonathan Chen wrote: > On Wed, Feb 20, 2002 at 10:07:17PM -0500, Eric I.Arnoth wrote: > > If anyone replies to my message, please be sure to keep my email on the CC or > > TO fields, I do not subscribe to this list. > > > > I've been trying to get a script which will take the output from syslog and > > handle it, but I can't get past the hello world stage. I've tried a bourne > > shell script and a python script (which is the language I want to write the > > end-result in). With the bourne shell script, I get countless error messages > > like the following, with decrementing subprocess IDs: > > > > ----------------------------------------------------- > > Feb 20 21:39:10 systemname syslogd: Logging subprocess 1894 (exec > > /hello_log.sh) exited with status 126. > > Feb 20 21:39:10 systemname syslogd: exec /hello_log.sh: Broken pipe > > ----------------------------------------------------- > > > > Here's the bournshell script hello_log.sh: > > ----------------------------------------------------- > > #!/bin/sh > > read line > > echo "$line" >> /test.out > > ----------------------------------------------------- > > syslogd runs as a daemon, and has no terminal associated with it. > When it runs your "read line" will fail, hence the broken pipe > message. No no. Syslog receives the message and then pipes it to the command, "read" in the shell script reads it's standard input, hence it gets the data from a pipe the shell invokes. It has nothing to do with terminals. If this were not the case the whole pipe-command mechanism of syslogd would never work. -- Regards Cliff Sarginson -- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message