"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 -------------------------------------------------------------------------