"James A. Crippen" <james@UnLambda.COM> writes:
On Thu, 5 Apr 2001, Florian Lohoff wrote:
On Thu, Apr 05, 2001 at 03:48:34PM +0200, David Rohleder wrote:
if [ -S /var/bird.ctl ] ; then echo already running fi
does the same thing.
And off course many daemons are using start-stop-daemon
Just by staring at it i saw a couple of ugly things - Must have been very early when i actually did it.
The above would only imply that the pipe exists but not actually tell you if bird is running.
"birdc" exits with an error code > 0 if bird is not reachable which i try to detect.
The problem with the start-stop-daemon is that it needs a pid file which when i remember correctly is not written by bird. One solution would have been to make a patch to bird (Which i had done if i remember) but i dropped it because of lazyness.
I have my own init system which uses a C program similar to debian's start-stop-daemon. I've written it such that given a command line flag the daemon spawning program will write a pid file if you know the daemon you're running doesn't write one (such as with bird). Once I did this I had no trouble starting and stopping bird using the pid file mechanism. Perhaps you might patch debian's start-stop-daemon to do a similar thing? It's a thought.
start-stop-daemon already does this: START-STOP-DAEMON(8) Debian GNU/Linux START-STOP-DAEMON(8) --make-pidfile Used when starting a program that does not create its own pid file. This option will make start-stop- daemon create the file referenced with --pidfile and place the pid into it just before executing the process. Note, it will not be removed when stopping the program. NOTE: This feature may not work in all cases. Most notably when the program being exe cuted forks from it's main process. Because of this it is usually only useful when combined with the --background option. -- ------------------------------------------------------------------------- David Rohleder davro@ics.muni.cz Institute of Computer Science, Masaryk University Brno, Czech Republic -------------------------------------------------------------------------
On Fri, Apr 06, 2001 at 10:30:44AM +0200, David Rohleder wrote:
I have my own init system which uses a C program similar to debian's start-stop-daemon. I've written it such that given a command line flag the daemon spawning program will write a pid file if you know the daemon you're running doesn't write one (such as with bird). Once I did this I had no trouble starting and stopping bird using the pid file mechanism. Perhaps you might patch debian's start-stop-daemon to do a similar thing? It's a thought.
start-stop-daemon already does this:
--make-pidfile Used when starting a program that does not create
*Urgs* Thanks for pointing that out - I didnt know that - I am currently also very busy on the mips/mipsel ports but i'll hope i can at least produce better init scripts soon. Flo -- Florian Lohoff flo@rfc822.org +49-5201-669912 Why is it called "common sense" when nobody seems to have any?
Well, that's the answer then. :) I had to deal with the forking problem as well. That's a pain. I wish people would standardize on daemon behavior. I really think that daemons shouldn't fork themselves at all, or at least provide a command line switch to disable this behavior. Many a daemon I've hacked on to add this feature. :) 'james -- James A. Crippen <james@unlambda.com> ,-./-. Anchorage, Alaska, Lambda Unlimited: Recursion 'R' Us | |/ | USA, 61.2069 N, 149.766 W, Y = \f.(\x.f(xx)) (\x.f(xx)) | |\ | Earth, Sol System, Y(F) = F(Y(F)) \_,-_/ Milky Way.
participants (3)
-
David Rohleder -
Florian Lohoff -
James A. Crippen