"Monitor" all of the supervisors.

@return void
17072
protected function monitorSupervisors()
    {
        $this->supervisors->each->monitor();

        $this->supervisors = $this->supervisors->reject->dead;
    }
933111
protected function start($supervisor)
    {
        if ($supervisor->options->nice) {
            proc_nice($supervisor->options->nice);
        }

        $supervisor->handleOutputUsing(function ($type, $line) {
            $this->output->write($line);
        });

        $supervisor->working = ! $this->option('paused');

        $supervisor->scale(max(
            0, $this->option('max-processes') - $supervisor->totalSystemProcessCount()
        ));

        $supervisor->monitor();
    }
658122
protected function job(): void
    {
        CorporationIndustryMiningObserver::where('corporation_id', $this->getCorporationId())
            ->get()->each(function ($observer) {

                while (true) {

                    $detail = $this->retrieve([
                        'corporation_id' => $this->getCorporationId(),
                        'observer_id'    => $observer->observer_id,
                    ]);

                    if ($detail->isCachedLoad()) return;

                    collect($detail)->each(function ($data) use ($observer) {

                        CorporationIndustryMiningObserverData::firstOrNew([
                            'corporation_id'          => $this->getCorporationId(),
                            'observer_id'             => $observer->observer_id,
                            'recorded_corporation_id' => $data->recorded_corporation_id,
                            'character_id'            => $data->character_id,
                            'type_id'                 => $data->type_id,
                            'last_updated'            => $data->last_updated,
                        ])->fill([
                            'quantity' => $data->quantity,
                        ])->save();

                    });

                    if (! $this->nextPage($detail->pages))
                        break;

                }

                $this->page = 1;
            });
    }
921696
public function sync()
    {
        $this->sync_single_log($this->_messages, '');
        $this->sync_single_log($this->_debugs, '_debug');
        $this->sync_single_log($this->_errors, '_error');
    }
1368578
protected function handleShutdowns() {
        declare(ticks = 1);

        $self = $this;

        $cleanup = function($signal = null) use ($self) {
            if ($signal === SIGTERM) {
                fprintf(STDERR, 'Received SIGTERM...');
            } else if ($signal === SIGINT) {
                fprintf(STDERR, 'Received SIGINT...');
            } else if ($signal === SIGTSTP) {
                fprintf(STDERR, 'Received SIGTSTP...');
            }

            $self->deleteAllLocks();
            exit;
        };

        if (extension_loaded('pcntl')) {
            pcntl_signal(SIGTERM, $cleanup, false);
            pcntl_signal(SIGINT, $cleanup, false);
            pcntl_signal(SIGTSTP, $cleanup, false);
        }

        register_shutdown_function($cleanup);
    }
1297415
public function listen()
    {
        $notifications = $this->repository->findSendable()->toArray();

        foreach ($notifications as $notification) {
            $this->listenNotificationsEvents($notification);
        }
    }
137512
public function poll()
    {
        $this->checkForNewSchedulers();

        foreach ($this->getMissedSchedules() as $scheduler) {
            $this->notifyIfChanges($scheduler);
            $this->setNextSchedule($scheduler);
        }

        foreach ($this->getOverdueNoExitSchedules() as $history) {
            $history->output = "No finish ping received by Eyewitness";
            $history->exitcode = 1;
            $history->save();

            if ($history->scheduler->alert_on_fail || ($history->scheduler->alert_run_time_greater_than > 0)) {
                $this->eye->notifier()->alert(new Overdue(['scheduler' => $history->scheduler]));
            }
        }

        foreach ($this->getConditionalSchedules() as $scheduler) {
            if ($this->hasNotRunInGivenTimeframe($scheduler)) {
                $this->notifyIfChanges($scheduler);
            }
        }
    }
351832
public function execute() {
        global $CFG;
        // If enabled, fetch information about available updates and eventually notify site admins.
        if (empty($CFG->disableupdatenotifications)) {
            $updateschecker = \core\update\checker::instance();
            $updateschecker->cron();
        }

    }
1023913
public function checkHealth()
    {
        if (!$this->process->isRunning()) {
            if ($this->status == self::STATUS_CLEANINGUP || $this->status == self::STATUS_CLEANEDUP) {
                //okay so we're ready to stop!
                $this->status = self::STATUS_DEAD;
                return true;
            } elseif ($this->status == ChildProcessContainer::STATUS_SLEEPY) {
                //okay so we're ready to stop!
                $this->status = self::STATUS_DEAD;
                return true;
            }
            $this->status = self::STATUS_DEAD;
            return false;
        } else {
            return true;
        }

    }
1333518
public function handle()
    {
        $this->getStream('clientHandler')->handle(new TimeoutTimer(AlphaRPC::WORKER_HANDLER_TIMEOUT / 3));
        $this->getStream('worker')->handle(new TimeoutTimer(AlphaRPC::WORKER_HANDLER_TIMEOUT / 3));
        $this->purgeWorkers();
        $this->handleRequests();
        $this->notify();
    }
1109344
public function loop()
    {
        try {
            $this->processPendingSignals();

            $this->processPendingCommands();

            // If the supervisor is working, we will perform any needed scaling operations and
            // monitor all of these underlying worker processes to make sure they are still
            // processing queued jobs. If they have died, we will restart them each here.
            if ($this->working) {
                $this->autoScale();

                $this->processPools->each->monitor();
            }

            // Next, we'll persist the supervisor state to storage so that it can be read by a
            // user interface. This contains information on the specific options for it and
            // the current number of worker processes per queue for easy load monitoring.
            $this->persist();

            event(new SupervisorLooped($this));
        } catch (Exception $e) {
            app(ExceptionHandler::class)->report($e);
        } catch (Throwable $e) {
            app(ExceptionHandler::class)->report(new FatalThrowableError($e));
        }
    }
310652
public static function runAll()
    {
        self::checkSapiEnv();
        self::init();
        self::parseCommand();
        self::daemonize();
        self::initWorkers();
        self::installSignal();
        self::saveMasterPid();
        self::forkWorkers();
        self::displayUI();
        self::resetStd();
        self::monitorWorkers();
    }
877931
public function handle(MasterSupervisorRepository $masters)
    {
        if ($masters->find(MasterSupervisor::name())) {
            return $this->comment('A master supervisor is already running on this machine.');
        }

        $master = (new MasterSupervisor)->handleOutputUsing(function ($type, $line) {
            $this->output->write($line);
        });

        ProvisioningPlan::get(MasterSupervisor::name())->deploy(
            $this->option('environment') ?? config('horizon.env') ?? config('app.env')
        );

        $this->info('Horizon started successfully.');

        pcntl_async_signals(true);

        pcntl_signal(SIGINT, function () use ($master) {
            $this->line('Shutting down...');

            return $master->terminate();
        });

        $master->monitor();
    }
608946
public function handle()
    {
        $this->info('Starting Custom Witness command...');

        foreach ($this->eye->getCustomWitnesses(true) as $witness) {
            $this->info('Running: '.$witness->getSafeName());

            $status = $this->runWitness($witness);
            $witness->saveHistory($status);
            $witness->checkHealth($status);
        }

        $this->info('Custom Witness command complete...');
    }
286184
protected function loop(): void
    {
        $job = $this->getJob();

        if (!$job) {
            $this->sleep();

            return;
        }

        $this->log->info(sprintf('got Job %s', $job->getId()));

        $this->getEventManager()->trigger('beforeFork', $job);
        $this->setWorkingOn($job);

        $this->child = $this->fork();

        // We are the Child Process
        if ($this->child === 0 || $this->child === false) {
            $this->runAsChild($job);
        }

        // We are the parent Process
        if ($this->child > 0) {
            $this->runAsParent($job);
        }

        $this->child = null;
        $this->finishedWorking();
    }
1185019
public function watch($files)
    {
        $files = (array) $files;

        foreach ($files as $file) {
            $path = realpath($file);
            $this->_watched[$path] = $path;
        }
        $this->refreshWatched();
    }
1230061
public function handle(): void
    {
        $this->comment('Scanning menu items..');
        $this->generateMenu();
        $this->info('Menu items: ' . count($this->adminMenuHolder));
        $this->comment('-');
    }