Gentoo Archives: gentoo-user

From: Harry Putnam <reader@×××××××.com>
To: gentoo-user@l.g.o
Subject: [gentoo-user] Re: [OT] attach a perl script to daemon services
Date: Fri, 26 Feb 2010 21:45:13
Message-Id: 87d3zrfza4.fsf@newsguy.com
In Reply to: Re: [gentoo-user] [OT] attach a perl script to daemon services by Alan McKinnon
1 Alan McKinnon <alan.mckinnon@×××××.com> writes:
2
3 >> Then tap into the fifo with a perl script that is written to be able
4 >> to sort and write the syslog output according to various regex that
5 >> may be part of startup cmd or fed in later during the running script.
6 >
7 > I don't know rsyslog at all (I use syslog-ng), but certain concepts
8 > are stable and universal.
9
10 Please reread my OP or maybe I should attempt to clarify what must be
11 a poorly written question.
12
13 I'm not asking help on anything about writing to a named pipe or
14 anything about the functioning of rsyslog... I know that part.
15
16 Not asking about the bulk of the perl scripting, such as sorting by
17 regex, reading from fifo, etc (are all understood [at least well enough]).
18
19 I want an overview/outline of how one goes about attaching a script to
20 the operations such as start/stop of a daemon
21
22 Even there... the additions necessary to the scripts in
23 /etc/init.d... are understood.
24
25 I guess I want to know if its even advisable to attach custom
26 scripting to a daemon or if there is a well worn path for doing that.
27
28 Assuming its not clear off the wall then:
29
30 Where I'm weak is the part where the custom script checks if the
31 daemon is running, before the script itself starts. That part would
32 need to be something pretty fool proof... maybe just grep ps output
33 for the daemon?
34
35 And where the custom script sends syslog (and sysadmin) a message in
36 the event the script itself is killed or dies for some unexpected
37 reason. Something like an EXIT `trap' in shell scripting... (how its
38 done is perl)

Replies

Subject Author
Re: [gentoo-user] Re: [OT] attach a perl script to daemon services Alan McKinnon <alan.mckinnon@×××××.com>