english/libraries/joomla/application/cli/daemon.php
/**
	 * Method to shut down the daemon and optionally restart it.
	 *
	 * @param   boolean  $restart  True to restart the daemon on exit.
	 *
	 * @return  void
	 *
	 * @since   11.1
	 */
Method to shut down the daemon and optionally restart it.
@param   boolean  $restart  True to restart the daemon on exit.

@return  void


Method to shut down the daemon and optionally restart it . @param boolean $restart True to restart the daemon on exit . @return void
protected function shutdown($restart = false)
	{
		if ($this->exiting) {
			return;
		}
		else {
			$this->exiting = true;
		}
		if ($this->running && $this->isActive()) {
			JLog::add('Process was not daemonized yet, just halting current process', JLog::INFO);
			$this->close();
		}
		$fp = fopen($this->config->get('application_pid_file'), 'r');
		$pid = fread($fp, filesize($this->config->get('application_pid_file')));
		$pid = intval($pid);
		fclose($fp);
		@ unlink($this->config->get('application_pid_file'));
		if ($restart) {
			$this->close(exec(implode(' ', $GLOBALS['argv']).' > /dev/null &'));
		}
		else {
			passthru('kill -9 '.$pid);
			$this->close();
		}
	}
protected function shutdown ( $ restart = false ) { if ( $ this -> exiting ) { return ; } else { $ this -> exiting = true ; } if ( $ this -> running && $ this -> isActive ( ) ) { JLog :: add ( 'Process was not daemonized yet, just halting current process' , JLog :: INFO ) ; $ this -> close ( ) ; } $ fp = fopen ( $ this -> config -> get ( 'application_pid_file' ) , 'r' ) ; $ pid = fread ( $ fp , filesize ( $ this -> config -> get ( 'application_pid_file' ) ) ) ; $ pid = intval ( $ pid ) ; fclose ( $ fp ) ; @ unlink ( $ this -> config -> get ( 'application_pid_file' ) ) ; if ( $ restart ) { $ this -> close ( exec ( implode ( ' ' , $ GLOBALS [ 'argv' ] ) . ' > /dev/null &' ) ) ; } else { passthru ( 'kill -9 ' . $ pid ) ; $ this -> close ( ) ; } }
Method to shut down the daemon and optionally restart it.
Method to shut down the daemon and optionally restart it .
// If we are already exiting, chill. // If not, now we are. // If we aren't already daemonized then just kill the application. // Read the contents of the process id file as an integer. // Remove the process id file. // If we are supposed to restart the daemon we need to execute the same command. // If we are not supposed to restart the daemon let's just kill -9.