function _exit() { _log(L_INFO, "Shutting down..."); $icarus = Icarus::getInstance(); if ($icarus->isRunning()) $icarus->end(); exit; }
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();