From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1Nl7zl-00032Y-D8 for garchives@archives.gentoo.org; Fri, 26 Feb 2010 21:45:13 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 74FEAE0AB2; Fri, 26 Feb 2010 21:44:37 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 53986E0AB2 for ; Fri, 26 Feb 2010 21:44:37 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with ESMTP id 08D201B46CE for ; Fri, 26 Feb 2010 21:44:37 +0000 (UTC) X-Virus-Scanned: amavisd-new at gentoo.org X-Spam-Score: -3.385 X-Spam-Level: X-Spam-Status: No, score=-3.385 required=5.5 tests=[AWL=-0.786, BAYES_00=-2.599] Received: from smtp.gentoo.org ([127.0.0.1]) by localhost (smtp.gentoo.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id TS0SCloOIkDh for ; Fri, 26 Feb 2010 21:44:27 +0000 (UTC) Received: from lo.gmane.org (lo.gmane.org [80.91.229.12]) by smtp.gentoo.org (Postfix) with ESMTP id 44D0B1B409C for ; Fri, 26 Feb 2010 21:44:23 +0000 (UTC) Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1Nl7yu-0007Lg-NI for gentoo-user@gentoo.org; Fri, 26 Feb 2010 22:44:20 +0100 Received: from c-98-215-178-110.hsd1.in.comcast.net ([98.215.178.110]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 26 Feb 2010 22:44:20 +0100 Received: from reader by c-98-215-178-110.hsd1.in.comcast.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 26 Feb 2010 22:44:20 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: gentoo-user@lists.gentoo.org From: Harry Putnam Subject: [gentoo-user] Re: [OT] attach a perl script to daemon services Date: Fri, 26 Feb 2010 15:44:03 -0600 Organization: Still searching... Message-ID: <87d3zrfza4.fsf@newsguy.com> References: <87tyt3g7rr.fsf@newsguy.com> <201002262222.08735.alan.mckinnon@gmail.com> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@lists.gentoo.org Reply-to: gentoo-user@lists.gentoo.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: c-98-215-178-110.hsd1.in.comcast.net User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:WNzs0jP5zmwnOsjEOYtdiEOT5Z8= X-Archives-Salt: 5473219c-b794-4dd2-a551-e93495742263 X-Archives-Hash: f4cdc708153518e9243a492bb8675a90 Alan McKinnon writes: >> Then tap into the fifo with a perl script that is written to be able >> to sort and write the syslog output according to various regex that >> may be part of startup cmd or fed in later during the running script. > > I don't know rsyslog at all (I use syslog-ng), but certain concepts > are stable and universal. Please reread my OP or maybe I should attempt to clarify what must be a poorly written question. I'm not asking help on anything about writing to a named pipe or anything about the functioning of rsyslog... I know that part. Not asking about the bulk of the perl scripting, such as sorting by regex, reading from fifo, etc (are all understood [at least well enough]). I want an overview/outline of how one goes about attaching a script to the operations such as start/stop of a daemon Even there... the additions necessary to the scripts in /etc/init.d... are understood. I guess I want to know if its even advisable to attach custom scripting to a daemon or if there is a well worn path for doing that. Assuming its not clear off the wall then: Where I'm weak is the part where the custom script checks if the daemon is running, before the script itself starts. That part would need to be something pretty fool proof... maybe just grep ps output for the daemon? And where the custom script sends syslog (and sysadmin) a message in the event the script itself is killed or dies for some unexpected reason. Something like an EXIT `trap' in shell scripting... (how its done is perl)