Fellow Monks,

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

#!/bin/bash ./server -nodb -co server.conf $@ & sleep 3 ./client_cli -user=admin -p=23000
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.

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:

#!/bin/bash ./server -nodb -co server.conf $@ ./client_cli -user=admin -p=23000
And the client_cli would always find a running server.

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


In reply to Backgrounding (daemonizing?) a Net::server by PetaMem

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.