Alan McKinnon <alan.mckin...@gmail.com> writes: > On Friday 26 February 2010 23:44:03 Harry Putnam wrote: >> 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? > > Maybe I'm misunderstanding you, but I don't understand this approach. > > If the daemon is not running there's nothing in the fifo. Why got to all the > complexity of writing an independent program that checks if something is > running then does various actions? The script necessarily depends on the > daemon running so instead of checking if it is, simply have the daemon start > the script. No daemon running = no script launched = no complexity.
In the back of my mind there was a reason on opensolaris, that the script would fail if the fifo was empty... Then once data comes the script isn't listening. Or syslog won't write or something similar. I also have an opensolaris box that will be using this same script. I don't want to back up and relocate all that right now... Not sure I have it remembered right either, it seems just easier to have the script check before trying to start (for portability). Solaris syslog can write to named pipes but no so readily as linux syslog. Not sure of the details now. > If I'm still off-bat and this approach cannot work for solid technical > reasons, then I'll go away and shut if if you say so :-) No, not off-base... thanks. The checking isn't so hard to figure anyway, but you didn't talk about the script having some kind of trap or something to cover unexpected kill or failure. Michael has covered that somewhat. Also I didn't think to search cpan for something that does what I want. That may turn up something I can just plug into. Michael Higgins <li...@evolone.org> writes: [...] > in my perl script: > > log_file=>'Sys::Syslog', pid_file=>'/var/run/evolone_agi.pid'; > > Sys::Syslog" is an interface to the UNIX syslog(3) program. > > from /etc/init.d/evolone_agi > > depend() { > need net asterisk postgresql-8.4 > } > > As for reading new information, there are a gazillion ways. Trap a > signal to reread the configs? > > reload() { > ebegin "Reloading evolone_agi configuration" > start-stop-daemon --signal 1 --pidfile /var/run/evolone_agi.pid > eend $? "Error reloading evolone_agi" > } Thanks ... good info. How does the script behave regarding what happens if it receives a sigINT or sigKILL, or some other way dies (even from an internal error)? Does it log to syslog? and notify sysadmin? I haven't had occasion to run into an `EXIT trap' in perl... but there must be such a thing.