The daemon's main run method. It should not be necessary to override,
instead use the main(), iterate() and cleanup() methods to implement
the daemons custom functionality.

@return void
@see \Thread::run()
439063
public function run()
    {

        try {
            // register shutdown handler
            register_shutdown_function($this->getDefaultShutdownMethod());

            // bootstrap the daemon
            $this->bootstrap();

            // mark the daemon as successfully shutdown
            $this->synchronized(function ($self) {
                $self->state = EnumState::get(EnumState::RUNNING);
            }, $this);

            // keep the daemon running
            while ($this->keepRunning()) {
                try {
                    $this->iterate($this->getDefaultTimeout());
                } catch (\Exception $e) {
                    $this->log(LogLevel::ERROR, $e->__toString());
                }
            }

            // clean up the instances and free memory
            $this->cleanUp();

            // mark the daemon as successfully shutdown
            $this->synchronized(function ($self) {
                $self->state = EnumState::get(EnumState::SHUTDOWN);
            }, $this);

        } catch (\Exception $e) {
            $this->log(LogLevel::ERROR, $e->__toString());
        }
    }
1146416
public static function start()
    {
        if (Bootstrap::$pid && Thread\Generic::ifExistsByPid(Bootstrap::$pid)) {
            Daemon::log('[START] phpDaemon with pid-file \'' . Daemon::$config->pidfile->value . '\' is running already (PID ' . Bootstrap::$pid . ')');
            exit(6);
        }

        Daemon::init();
        $pid = Daemon::spawnMaster();
        file_put_contents(Daemon::$config->pidfile->value, $pid);
    }
915664
public function run()
	{
		if ( $this->description )
			touch( $this->mutexPath() );

		try
		{
			UniversalBuilder::call( $this->callback, $this->parameters )
		}
		finally
		{
			$this->removeMutex();
		}

		parent::callAfterCallbacks();

		return $response;
	}
25458
public function main()
    {
        if ($this->isMaintenanceModeEnabled()) {
            $this->logger->info("Archiving won't run because maintenance mode is enabled");
            return;
        }

        $self = $this;
        Access::doAsSuperUser(function () use ($self) {
            $self->init();
            $self->run();
            $self->runScheduledTasks();
            $self->end();
        });
    }
1070879
public function run(): bool
    {
        if ($this->startup) {
            $this->logger->debug('Calling startup callback');
            call_user_func($this->startup, $this);
        }

        $actions = implode(', ', array_keys($this->callbacks));
        $this->logger->info("Component running with callbacks for $actions");
        $this->executor->execute(
            $this->apiFactory,
            $this->input,
            $this->callbacks,
            $this->error
        );

        if ($this->shutdown) {
            $this->logger->debug('Calling shutdown callback');
            call_user_func($this->shutdown, $this);
        }

        return true;
    }
731337
def run_daemon(self):
        
        try:
            self.daemon_runner.do_action()
        except daemon.runner.DaemonRunnerStopFailureError:
            self.onStopFail()
        except SystemExit:
            self.onExit()
945355
public static function runAll()
    {
        static::checkSapiEnv();
        static::init();
        static::lock();
        static::parseCommand();
        static::daemonize();
        static::initWorkers();
        static::installSignal();
        static::saveMasterPid();
        static::unlock();
        static::displayUI();
        static::forkWorkers();
        static::resetStd();
        static::monitorWorkers();
    }
645201
public function run()
    {
        Model::unguard();

        DB::table('core__media')->delete();
        DB::table('core__activities')->delete();

        $this->clearStoredMedia();
    }
1243947
public function run()
    {
        $vendorDir = dirname(dirname(__FILE__));
        $baseDir = dirname($vendorDir);
        spl_autoload_register(function ($className) use($baseDir) {
            if (file_exists($file = $baseDir . '/database/seeds/' . $className . '.php')) {
                include($file);
                return true;
            }
        });

        $this->call([
            ModulesTableSeeder::class,
            PrivilegesTableSeeder::class,
            SettingsTableSeeder::class,
        ]);
    }
928709
public function run()
    {
        $keys = array_merge($this->keys(), array_keys($this->definitions));
        foreach ($keys as $key) {
            $content = $this->get($key);

            if (is_object($content)) {
                try {
                    $reflection = new ReflectionClass($content);
                    if ($reflection->hasMethod('run')) {
                        $content->run();
                    }
                } catch (ReflectionException $e) {
                }
            }
        }
    }
1136977
public function run()
    {
        $topdir = $this->getBasePath();

        foreach (scandir($topdir) as $filename) {

            // Skip directory link files
            if (($filename == '.') || ($filename == '..')) {
                continue;
            }

            if (is_dir($topdir . DIRECTORY_SEPARATOR . $filename)) {
                // Recurse into lower level directory, providing the namespace
                $this->loadFiles($filename, $filename);
            }
        }
    }
1187428
public function startCommand(): void
    {
        $daemon = $this->getSameOpt(['d', 'daemon']);

        $this->createServer()->asDaemon($daemon)->start();
    }
1273454
public function run()
    {
        Debug::enable();

        // make whatever is necessary to disable all stuff that could buffer output
        ini_set('zlib.output_compression', 0);
        ini_set('output_buffering', 0);
        ini_set('implicit_flush', 1);
        ob_implicit_flush(1);

        $this->loop = Factory::create();
        $this->controller = new UnixServer($this->getControllerSocketPath(), $this->loop);
        $this->controller->on('connection', [$this, 'onSlaveConnection']);

        $this->web = new Server(sprintf('%s:%d', $this->host, $this->port), $this->loop);
        $this->web->on('connection', [$this, 'onRequest']);

        $this->loop->addSignal(SIGTERM, [$this, 'shutdown']);
        $this->loop->addSignal(SIGINT, [$this, 'shutdown']);
        $this->loop->addSignal(SIGCHLD, [$this, 'handleSigchld']);
        $this->loop->addSignal(SIGUSR1, [$this, 'restartSlaves']);
        $this->loop->addSignal(SIGUSR2, [$this, 'reloadSlaves']);

        if ($this->isDebug()) {
            $this->loop->addPeriodicTimer(0.5, function () {
                $this->checkChangedFiles();
            });
        }

        $loopClass = (new \ReflectionClass($this->loop))->getShortName();

        $this->output->writeln("<info>Starting PHP-PM with {$this->slaveCount} workers, using {$loopClass} ...</info>");
        $this->writePid();

        $this->createSlaves();

        $this->loop->run();
    }
1250528
public function run()
    {
        $resolvedRequest = $this->router->route($this->request);
        echo $this->dispatcher->dispatch($resolvedRequest);
    }
130538
public final function run()
    {
        $this->registerServices();
        $this->registerCommands();
        return $this->symfonyApplication->run($this->input, $this->output);
    }
520100
public function run()
    {
        $this->addPending();
        $this->ran = true;

        while (count($this->inProcess) !== 0) {

            $this->monitorPending();
        }

        // Clear the references for callbacks.
        $this->onSuccess = null;
        $this->onError = null;
    }
408623
public function run()
    {
        \define("AMP_CONTEXT", "thread");
        \define("AMP_CONTEXT_ID", $this->id);

        /* First thing we need to do is re-initialize the class autoloader. If
         * we don't do this first, any object of a class that was loaded after
         * the thread started will just be garbage data and unserializable
         * values (like resources) will be lost. This happens even with
         * thread-safe objects.
         */

        // Protect scope by using an unbound closure (protects static access as well).
        (static function () {
            $paths = [
                \dirname(__DIR__, 3) . \DIRECTORY_SEPARATOR . "vendor" . \DIRECTORY_SEPARATOR . "autoload.php",
                \dirname(__DIR__, 5) . \DIRECTORY_SEPARATOR . "autoload.php",
            ];

            foreach ($paths as $path) {
                if (\file_exists($path)) {
                    $autoloadPath = $path;
                    break;
                }
            }

            if (!isset($autoloadPath)) {
                throw new \Error("Could not locate autoload.php");
            }

            require $autoloadPath;
        })->bindTo(null, null)();

        // At this point, the thread environment has been prepared so begin using the thread.

        if ($this->killed) {
            return; // Thread killed while requiring autoloader, simply exit.
        }

        Loop::run(function () {
            $watcher = Loop::repeat(self::KILL_CHECK_FREQUENCY, function () {
                if ($this->killed) {
                    Loop::stop();
                }
            });
            Loop::unreference($watcher);

            try {
                $channel = new ChannelledSocket($this->socket, $this->socket);
                yield from $this->execute($channel);
            } catch (\Throwable $exception) {
                return; // Parent context exited or destroyed thread, no need to continue.
            } finally {
                Loop::cancel($watcher);
            }
        });
    }