Start tasks provided from the command line
@name    startRequested
@access  internal
@return  bool  started
8385
function startRequested() {
		var start = [];

		if (run.length) {
			run.forEach(function(task) {
				var exists = task.replace(/:.*$/, '') in definitions.task;

				console.log(
					'Task %s %s',
					exists ? chalk.green(task) : chalk.red(task),
					exists ? 'running' : 'not found!'
				);

				if (exists) {
					start.push(task);
				}
			});

			if (start.length) {
				gulp.start.apply(gulp, start.concat([function(error) {
					if (error) {
						throw new Error(error);
					}

					console.log('Complete');
				}]));
			}
			else {
				console.log(chalk.red('No tasks are running, exiting!'));
				process.exit(1);
			}
		}

		return !!start.length;
	}
793082
public function start()
    {
        if (!$this->hasStarted()) {
            $this->setStarted();
            $this->dispatch(RunEvent::STARTED, new RunEvent($this));
            try {
                try {
                    $output = call_user_func($this->callback);
                    $this->handleOutput($output);
                    $this->setFinished();
                    $this->successful = true;
                    $this->dispatch(RunEvent::SUCCESSFUL, new RunEvent($this));
                } catch (Exception $e) {
                    $this->setFinished();
                    $this->successful = false;
                    $this->exception = $e;
                    $this->dispatch(RunEvent::FAILED, new RunEvent($this));
                } catch (Throwable $e) {
                    $this->setFinished();
                    $this->successful = false;
                    $this->exception = $e;
                    $this->dispatch(RunEvent::FAILED, new RunEvent($this));
                }
            } finally {
                $this->dispatch(RunEvent::COMPLETED, new RunEvent($this));
            }
        }

        return $this;
    }
765214
public function start()
    {
        $this->bufferized = true;
        $newHelper = clone $this;
        $this->bufferized = false;
        return $newHelper;
    }
1228542
private function launch()
    {
        $action = $this->arg->getParameter('action');

        if (!in_array($action, ['server', 'console'])) {
            $this->throwFailsCommand('help run');
        }

        $this->command->call(
            'run',
            $action,
            $this->arg->getParameter('target')
        );
    }
19392
public function start()
    {
        if (!$this->isActive()) {
            return true;
        }

        if (!$this->hasCache()) {
            ob_start();
            return true;
        }

        $this->getCache(true);
        return false;
    }
355997
public function start() {
        if (!$this->isStarted) {
            $this->generateIpcServer();
            $this->isStarted = true;
            for ($i=0;$i<$this->poolSizeMin;$i++) {
                $this->spawnWorker();
            }
            $this->registerTaskTimeoutWatcher();
        }

        return $this;
    }
1358336
public function start()
    {
        if ($collector = end(static::$_collectors)) {
            $collector->add($collector->_driver->stop());
        }
        static::$_collectors[] = $this;
        $this->_driver->start();
        return true;
    }
16444
public function start()
    {
        $result = array();
        if(count($this->helper_callbacks) > 0){
            foreach($this->helper_callbacks as $callback){
                $return_value = call_user_func_array($callback, array($this));
                $result[] = $return_value;
            }
        }
        return $result;
    }
223473
public function start()
    {
        $this->workerHandlerReady = true;
        $this->serviceStreamReady = true;
        $this->sendToService(new ActionListRequest());
    }
686517
protected function launchNextTask()
    {
        if (! $this->numberOfThreadsToLaunch) {
            return false;
        }
        
        $taskInfos = $this->pool[$this->numberOfTasks - $this->numberOfThreadsToLaunch];
        
        $taskInfos['task']->fork();
        $this->numberOfRunningThreads++;
        $this->numberOfThreadsToLaunch--;
        
        return true;
    }
824709
private function _start()
	{
		if ($this->_state === self::STATE_RESTART) {
			session_id($this->_createId());
		}

		session_cache_limiter('none');

		return session_start();
	}
546454
public function start()
    {
        if (count($this->tasks) == 0)
            throw new \Exception("There are no tasks defined - can not start");

        $this->started = true;

        $options = static::getOptions();
        $debug = @$options['debug'] === true;

        $pidFile = $options['pid_file'];
        if (!$pidFile)
            throw new \Exception("No pid_file in the config");

        $fpPid = fopen($pidFile, "c");
        if (!$fpPid)
            throw new \Exception("Could not open " . $pidFile);

        if (!flock($fpPid, LOCK_EX | LOCK_NB)) {
            fclose($fpPid);
            if ($debug)
                echo "==> Daemon already running" . PHP_EOL;
            return $this;
        }

        if ($debug)
            echo "==> Starting the daemon... " . PHP_EOL;

        $fork = pcntl_fork();
        if ($fork < 0)
            throw new \Exception("fork() failed: $fork");
        else if ($fork)
            return $this;

        ftruncate($fpPid, 0);
        fwrite($fpPid, getmypid() . PHP_EOL);
        fflush($fpPid);
        chmod($pidFile, 0666);

        declare(ticks = 1);

        $exitCallback = function ($signo) use ($fpPid, $pidFile, $debug) {
            if ($debug)
                echo "==> Cleaning and exiting" . PHP_EOL;

            foreach ($this->pids as $pid) {
                if ($debug)
                    echo "==> Terminating worker PID $pid" . PHP_EOL;
                posix_kill($pid, SIGTERM);
            }
            foreach ($this->pids as $pid)
                pcntl_waitpid($pid, $status);

            flock($fpPid, LOCK_UN);
            fclose($fpPid);
            @unlink($pidFile);

            if ($debug)
                echo "==> Daemon is shut down" . PHP_EOL;
            exit;
        };

        pcntl_signal(SIGTERM, $exitCallback);
        pcntl_signal(SIGINT, $exitCallback);
        pcntl_signal_dispatch();

        $sid = posix_setsid();
        if ($sid < 0)
            throw new \Exception("setsid() failed: $sid");

        $gmWorker = new GearmanWorker();
        $gmWorker->addServer($options['gearman']['host'], $options['gearman']['port']);

        foreach ($this->tasks as $name => $object) {
            $function = $options['namespace'] . '-' . $name;
            $task = function ($job) use ($name, $function, $object, $options) {
                if (@$options['debug'] === true)
                    echo "==> Running worker for: $function (PID " . getmypid() . ")" . PHP_EOL;

                $worker = clone $object;
                $data = json_decode($job->workload(), true);
                $worker->setData($data);

                if (@$options['debug'] !== true)
                    ob_start();
                $worker->run($this->exitRequested);
                if (@$options['debug'] !== true)
                    ob_end_clean();
            };
            $gmWorker->addFunction($function, $task);
        }

        while (true) {
            $dead = pcntl_waitpid(-1, $status, WNOHANG);
            while ($dead > 0) {
                if (@$options['debug'] === true)
                    echo "==> Worker PID $dead terminated" . PHP_EOL;

                $index = array_search($dead, $this->pids);
                if ($index !== false)
                    unset($this->pids[$index]); 

                $dead = pcntl_waitpid(-1, $status, WNOHANG);
            }

            while (count($this->pids) < $options['num_workers']) {
                $pid = pcntl_fork();
                if ($pid == 0) {
                    declare(ticks = 1);

                    $exitCallback = function ($signo) {
                        $this->exitRequested = true;
                    };

                    pcntl_signal(SIGTERM, $exitCallback);
                    pcntl_signal(SIGINT, $exitCallback);
                    pcntl_signal_dispatch();

                    $this->pids = [];
                    $gmWorker->setTimeout(1000);
                    while (!$this->exitRequested) {
                        $gmWorker->work();
                        $code = $gmWorker->returnCode();
                        switch ($code) {
                            case GEARMAN_TIMEOUT:
                                sleep(1);
                                break;
                            case GEARMAN_SUCCESS:
                                $this->exitRequested = true;
                                break;
                            default:
                                if (@$options['debug'] === true)
                                    echo "==> Worker failed: $code";
                                exit(1);
                        }
                    }
                    exit;
                } else if ($pid > 0) {
                    $this->pids[] = $pid;
                }
            }

            sleep(1);
        }
    }
1139518
public function build(): StartRequest
	{
		$instance = new StartRequest();
		$instance->categories = $this->categories;
		$instance->options = $this->options;
		$instance->bufferUsageReportingInterval = $this->bufferUsageReportingInterval;
		$instance->transferMode = $this->transferMode;
		$instance->streamFormat = $this->streamFormat;
		$instance->streamCompression = $this->streamCompression;
		$instance->traceConfig = $this->traceConfig;
		return $instance;
	}
584143
public function start()
    {
        if (!headers_sent()) {
            if (!$this->started && $this->status() !== PHP_SESSION_ACTIVE) {
                session_start();
                $this->started = true;

                return true;
            }
        }

        return false;
    }
309347
public function start()
    {
        foreach ($this->processes as $pid => $process) {
            if (!$process->isStarted()) {
                $process->runAsync();
            }
        }
    }
738467
public function start()
    {
        if ($this->isStarted) {
            return;
        }

        foreach ($this->curls as $ch) {
            $this->initHandle($ch);
        }

        $this->isStarted = true;

        do {
            curl_multi_select($this->multiCurl);
            curl_multi_exec($this->multiCurl, $active);

            while (!($info_array = curl_multi_info_read($this->multiCurl)) === false) {
                if ($info_array['msg'] === CURLMSG_DONE) {
                    foreach ($this->curls as $key => $ch) {
                        if ($ch->curl === $info_array['handle']) {
                            $ch->curlErrorCode = $info_array['result'];
                            $ch->exec($ch->curl);
                            curl_multi_remove_handle($this->multiCurl, $ch->curl);
                            unset($this->curls[$key]);

                            // Close open file handles and reset the curl instance.
                            if (!($ch->fileHandle === null)) {
                                $ch->downloadComplete($ch->fileHandle);
                            }
                            break;
                        }
                    }
                }
            }

            if (!$active) {
                $active = count($this->curls);
            }
        } while ($active > 0);

        $this->isStarted = false;
    }
341652
public function start()
    {

        $state = $this->getState();

        if (in_array($state, [self::STATE_T_START, self::STATE_T_STOP, self::STATE_T_KILL])) {

            $processId = $this->getProcessId();

            if (!$this->processExists()) {

                $this->getLogger()
                    ->warning("Daemon is ill can't find process {$processId}, try clean data and continue starting",
                        [__NAMESPACE__]);
                $this->cleanData();

                // continue start

            } else {
                $this->getLogger()
                    ->info("Daemon can't START, cause state : {$state}, and process exists {$processId}",
                        [__NAMESPACE__]);

                return false;
            }
        }

        $this->setProcessId($pid = intval(getmypid()));
        $this->setData(self::P_CREATED_TIME, time());
        $this->setState(self::STATE_T_START);

        try {
            $this->mainLoop();
            $this->waitManagersDone();
        } catch (\Exception $ex) {
            $this->getLogger()->warning($ex->getMessage(), [__NAMESPACE__]);
        }

        $this->cleanData();

        return true;
    }