Example #1
0
function _exit()
{
        _log(L_INFO, "Shutting down...");
        $icarus = Icarus::getInstance();
        if ($icarus->isRunning()) $icarus->end();
	exit;
}
Example #2
0
				break;
                        case 'f':
				$GLOBALS['fork'] = true;
				break;
                }
	}
}

if ($GLOBALS['fork'] === true)
{
	_log(L_DEBUG, 'Forking into the background...');
	$pid = pcntl_fork();
	if ($pid == -1)
		_log(L_FATAL, 'Failed to fork into the background. Exiting.');
	else if ($pid)
	{
		_log(L_DEBUG, 'Forked successfully. Exiting parent.');
		exit;
	}
	else
	{
		// we're in the child!
		$logger = Logger::getInstance();
		$logger->fork();
	}

}

$icarus = Icarus::getInstance();
$icarus->start();