PetaMem has asked for the wisdom of the Perl Monks concerning the following question:
I'm trying to do $SUBJ and have read this, this, this, this and this.
I also browsed the docs for Net::Server::Multiplex as well as Proc::Daemon.
My problem seems quite simple. I need to asynchronize a startup process. It goes like this: Current script is
Basically a server process is set up, and one client is started. This is just a small script for minimizing the typing when the server has to go up and down during the development cycle. Unfortunatedly, on different machines server startup takes different time, so sometimes the 3 seconds are too much, sometimes not enough. Sometimes they might be enough, but other load on the machine slows the startup process down, plus during development as some more initializations happen within the server and... you get the idea.#!/bin/bash ./server -nodb -co server.conf $@ & sleep 3 ./client_cli -user=admin -p=23000
The result is, that there is often the case, when a client doesn't find a running server yet after the 3 seconds, and setting it up every second more just annoys during startup. But more importantly: Its the wrong solution and I would like to do it right so I could have something like this:
And the client_cli would always find a running server.#!/bin/bash ./server -nodb -co server.conf $@ ./client_cli -user=admin -p=23000
So the first problem I'm facing is the documentation of Proc::Daemon. It mentions, that Daemon != Server. Hm. I think I have a Server I need to background itself when initialization is done. It is not that good if this process would chdir to "/", but right now it doesn't matter.
The docs mention, that FTP,HTTP servers run often as daemons. So why the hell is Daemon != Server?
Ok. Next problem is, that if I put Proc::Daemon::Init just after all initializations have been done, the Daemon/Server goes to CPU load 100% and doesn't return.
HOWTO?
Thank you for any suggestions.
Bye
PetaMem All Perl: MT, NLP, NLU
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Backgrounding (daemonizing?) a Net::server
by UnderMine (Friar) on Mar 28, 2004 at 09:26 UTC | |
|
Re: Backgrounding (daemonizing?) a Net::server
by matija (Priest) on Mar 28, 2004 at 09:42 UTC | |
by PetaMem (Priest) on Mar 28, 2004 at 11:42 UTC | |
by matija (Priest) on Mar 28, 2004 at 17:39 UTC | |
|
Re: Backgrounding (daemonizing?) a Net::server
by Anonymous Monk on Mar 28, 2004 at 23:34 UTC | |
|
Re: Backgrounding (daemonizing?) a Net::server
by Thelonius (Priest) on Mar 28, 2004 at 16:44 UTC | |
|
Re: Backgrounding (daemonizing?) a Net::server
by Thelonius (Priest) on Mar 30, 2004 at 15:49 UTC | |
|
Re: Backgrounding (daemonizing?) a Net::server
by flyingmoose (Priest) on Mar 29, 2004 at 02:49 UTC | |
| A reply falls below the community's threshold of quality. You may see it by logging in. |