Rainer --

This is not enough; you also need to close stdin, stdout, and stderr.  I also 
don't think we want to print something to stdout from the child -- it's a race 
condition.



On Feb 23, 2011, at 9:17 AM, rusra...@osl.iu.edu wrote:

> Author: rusraink
> Date: 2011-02-23 09:17:50 EST (Wed, 23 Feb 2011)
> New Revision: 1385
> URL: https://svn.open-mpi.org/trac/mtt/changeset/1385
> 
> Log:
> - Add --daemon parameter to fork mtt-relay into background.
> 
> 
> Text files modified: 
>   trunk/client/mtt-relay |    13 +++++++++++++                           
>   1 files changed, 13 insertions(+), 0 deletions(-)
> 
> Modified: trunk/client/mtt-relay
> ==============================================================================
> --- trunk/client/mtt-relay    (original)
> +++ trunk/client/mtt-relay    2011-02-23 09:17:50 EST (Wed, 23 Feb 2011)
> @@ -23,6 +23,7 @@
> chomp $HOST;
> 
> my $PORT = "8008";
> +my $daemon = 0;
> my $debug = 0;
> my $quiet = 0;
> my $url = 'https://www.open-mpi.org/mtt/submit/index.php';
> @@ -32,6 +33,7 @@
> Getopt::Long::GetOptions(
>     "port|p=i" => \$PORT,
>     "host|h=s" => \$HOST,
> +    "daemon"   => \$daemon,
>     "debug|d"  => \$debug,
>     "url|u=s"  => \$url,
>     "help"     => \$help,
> @@ -44,6 +46,7 @@
>  --port|-p     Port that $0 listens on (default: $PORT)
>  --host|-h     Specify $0's host (default: $HOST)
>  --url|-u      MTT results submission URL (default: $url)
> + --daemon      Daemon mode (fork into background)
>  --debug|-d    Debug mode
>  --help        This message
> EOT
> @@ -96,6 +99,16 @@
>     print "Set your proxy to <URL:" . $master->url . ">\n";
>     my $slave;
> 
> +    if ($daemon) {
> +        my $pid = fork();
> +        if($pid) {
> +            print "# Daemon Parent exiting\n";
> +            exit 0;
> +        } else {
> +            print "# Daemon Child process continuing\n";
> +        }
> +    }
> +
>     while (1) {
>         while ($slave = $master->accept) {
>             &handle_connection($slave);
> _______________________________________________
> mtt-svn mailing list
> mtt-...@open-mpi.org
> http://www.open-mpi.org/mailman/listinfo.cgi/mtt-svn


-- 
Jeff Squyres
jsquy...@cisco.com
For corporate legal information go to:
http://www.cisco.com/web/about/doing_business/legal/cri/


Reply via email to