english/libraries/joomla/application/cli/daemon.php
/**
	 * This is truly where the magic happens.  This is where we fork the process and kill the parent
	 * process, which is essentially what turns the application into a daemon.
	 *
	 * @return  void
	 *
	 * @since   11.1
	 * @throws  ApplicationException
	 */
This is truly where the magic happens.  This is where we fork the process and kill the parent
process, which is essentially what turns the application into a daemon.

@return  void


This is truly where the magic happens . This is where we fork the process and kill the parent process which is essentially what turns the application into a daemon . @return void
protected function fork()
	{
		JLog::add('Forking the '.$this->name.' daemon.', JLog::DEBUG);
		$pid = pcntl_fork();
		if ($pid === -1) {
			JLog::add('Process could not be forked.', JLog::WARNING);
			throw new ApplicationException();
		}
		elseif ($pid) {
			JLog::add('Ending '.$this->name.' parent process', JLog::DEBUG);
			$this->close();
		}
		else {
			$this->exiting = false;
			$this->running = true;
			$this->processId = (int) posix_getpid();
		}
	}
protected function fork ( ) { JLog :: add ( 'Forking the ' . $ this -> name . ' daemon.' , JLog :: DEBUG ) ; $ pid = pcntl_fork ( ) ; if ( $ pid === - 1 ) { JLog :: add ( 'Process could not be forked.' , JLog :: WARNING ) ; throw new ApplicationException ( ) ; } elseif ( $ pid ) { JLog :: add ( 'Ending ' . $ this -> name . ' parent process' , JLog :: DEBUG ) ; $ this -> close ( ) ; } else { $ this -> exiting = false ; $ this -> running = true ; $ this -> processId = ( int ) posix_getpid ( ) ; } }
This is truly where the magic happens.
This is truly where the magic happens .
// Attempt to fork the process. // If we could not fork the process log the error and throw an exception. // Error // If the pid is positive then we successfully forked, and can close this application. // Add the log entry for debugging purposes and exit gracefully. // We are in the forked child process. // Setup some protected values.