Gentoo Archives: gentoo-user

From: Michael Higgins <linux@×××××××.org>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Re: [OT] attach a perl script to daemon services
Date: Fri, 26 Feb 2010 23:35:14
Message-Id: 20100226153429.208cc1f5@lappy.evolone.org
In Reply to: Re: [gentoo-user] Re: [OT] attach a perl script to daemon services by Alan McKinnon
1 On Sat, 27 Feb 2010 01:00:43 +0200
2 Alan McKinnon <alan.mckinnon@×××××.com> wrote:
3
4 > > Where I'm weak is the part where the custom script checks if the
5 > > daemon is running, before the script itself starts. That part would
6 > > need to be something pretty fool proof... maybe just grep ps output
7 > > for the daemon?
8
9 I have a perl fastAGI script that launches in /etc/init.d/.... I just
10 cribbed some code from something there...
11
12 in my perl script:
13
14 log_file=>'Sys::Syslog', pid_file=>'/var/run/evolone_agi.pid';
15
16 Sys::Syslog" is an interface to the UNIX syslog(3) program.
17
18 from /etc/init.d/evolone_agi
19
20 depend() {
21 need net asterisk postgresql-8.4
22 }
23
24 As for reading new information, there are a gazillion ways. Trap a
25 signal to reread the configs?
26
27 reload() {
28 ebegin "Reloading evolone_agi configuration"
29 start-stop-daemon --signal 1 --pidfile /var/run/evolone_agi.pid
30 eend $? "Error reloading evolone_agi"
31 }
32
33 .. for example.
34
35 Hope this helps. '-)
36
37
38 --
39 |\ /| | | ~ ~
40 | \/ | |---| `|` ?
41 | |ichael | |iggins \^ /
42 michael.higgins[at]evolone[dot]org