diff -r 000000000000 -r eb6d4ce6fd78 src/fork.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/fork.js Tue Aug 12 18:32:40 2014 +0200 @@ -0,0 +1,62 @@ +#! /usr/bin/env nodejs +// +// mDNSGw - Zero Configuration DNS Gateway for Mesh Networks +// Copyright © 2014 Michael Schloh von Bennewitz +// +// Permission to use, copy, modify, and/or distribute this software for +// any purpose with or without fee is hereby granted, provided that the +// above copyright notice and this permission notice appear in all copies. +// +// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL +// WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE +// AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL +// DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR +// PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS +// ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +// THIS SOFTWARE. +// +// This file is part of mDNSGw, a Zero configuration DNS gateway +// which can be found at http://dev.europalab.com/mdnsgw/ +// +// fork.js: ECMA JavaScript implementation +// + +/*********************************************************** +| ____ _ _ ____ ____ | +| _ __ ___ | _ \| \ | / ___| / ___|_ __ | +| | '_ ` _ \| | | | \| \___ \| | _\ \ /\ / / | +| | | | | | | |_| | |\ |___) | |_| |\ V V / | +| |_| |_| |_|____/|_| \_|____/ \____| \_/\_/ | +| | +| Requirements: Redis server with standard configuration | +| NodeJS and NPM modules (see package.json) | +| | +| Execute: To start this application, launch it with the | +| script named fork.js: $ ./fork.js | +| | +| Support: http://list.europalab.com/mailman/mdnsgs/ | +| | +***********************************************************/ + +// import module dependencies +var forkserv = require('forever-monitor'); + + +// configure a child process to daemonize +var childproc = new (forkserv.Monitor)('app.js', { + max: 4, + silent: true, + pidFile: 'mdnsgw.pid', + logFile: 'mdnsgw.log', + outFile: 'mdnsgw.out', + errFile: 'mdnsgw.err', + options: [] +}); + +childproc.on('exit', function () { + console.log('app.js has exited after 4 restarts'); +}); + +// fork a child +childproc.start();