Schedules all system cron jobs.
977425
def ScheduleSystemCronJobs(names=None):
  """"""

  errors = []
  disabled_classes = config.CONFIG["Cron.disabled_cron_jobs"]
  for name in disabled_classes:
    try:
      cls = registry.SystemCronJobRegistry.CronJobClassByName(name)
    except ValueError:
      errors.append("Cron job not found: %s." % name)
      continue

  if names is None:
    names = iterkeys(registry.SystemCronJobRegistry.SYSTEM_CRON_REGISTRY)

  for name in names:

    cls = registry.SystemCronJobRegistry.CronJobClassByName(name)

    enabled = cls.enabled and name not in disabled_classes
    system = rdf_cronjobs.CronJobAction.ActionType.SYSTEM_CRON_ACTION
    args = rdf_cronjobs.CronJobAction(
        action_type=system,
        system_cron_action=rdf_cronjobs.SystemCronAction(job_class_name=name))

    job = rdf_cronjobs.CronJob(
        cron_job_id=name,
        args=args,
        enabled=enabled,
        frequency=cls.frequency,
        lifetime=cls.lifetime,
        allow_overruns=cls.allow_overruns)
    data_store.REL_DB.WriteCronJob(job)

  if errors:
    raise ValueError(
        "Error(s) while parsing Cron.disabled_cron_jobs: %s" % errors)
422690
public function scheduleWork()
    {
        if (is_null($this->scheduler)) {
            return;
        }

        $this->scheduler->reconnect();

        foreach ($this->scheduler->getJobsFor(new \DateTime()) as $job) {
            $this->pipeline->enqueue($job);
        }
    }
1314868
public function checkForNewSchedulers()
    {
        $current = SchedulerRepo::all();

        foreach($this->getScheduledEvents() as $event) {
            if (count($current->where('mutex', $event['mutex'])) < 1) {
                $command = new SchedulerRepo;
                $command->fill($event);
                $command->save();
            }
        }
    }
1123603
def schedule_tasks(self):
        
        url = 'api/v6/releases/%d/schedule-tasks' % self.id
        tasks = yield self.connection._get(url)
        defer.returnValue(munchify(tasks))
530336
public function register_cron() {
		if ( ! wp_next_scheduled( $this->event ) ) {
			wp_schedule_event( $this->start_at(), $this->schedule, $this->event, $this->args() );
		}
		add_action( $this->event, [ $this, 'process' ] );
	}
719597
public function main() {
		$this->out(__d('cake_notify', 'Cron task Shell'));
		$this->hr();
		$this->out(__d('cake_notify', 'This shell is used to execute task scheduled.'));
		$this->out(__d('cake_notify', 'Available tasks: %s.', CakeText::toList(constsVals('CAKE_NOTIFY_CRON_TASK_'), __d('cake_notify', 'and'))));
	}
937399
public function executeCron()
    {
        $this->controlAccessExecuteCron();
        $this->cron->run();
        $this->response->outputHtml($this->text('Cron has started'));
    }
1228547
public function listAllRunningSchedulesAction()
    {
        $processManager = Mage::getModel('aoe_scheduler/processManager'); /* @var $processManager Aoe_Scheduler_Model_ProcessManager */
        foreach ($processManager->getAllRunningSchedules() as $schedule) { /* @var $schedule Aoe_Scheduler_Model_Schedule */
            $status = $schedule->isAlive();
            if (is_null($status)) {
                $status = '?';
            } else {
                $status = $status ? 'alive' : 'dead (updating status to "disappeared")';
            }
            echo sprintf(
                "%-30s %-10s %-10s %-10s %-10s\n",
                $schedule->getJobCode(),
                $schedule->getHost() ? $schedule->getHost() : '(no host)',
                $schedule->getPid() ? $schedule->getPid() : '(no pid)',
                $schedule->getLastSeen() ? $schedule->getLastSeen() : '(never)',
                $status
            );
        }
    }
150967
public function enqueueCron(string $cron, Job $job): void
    {
        $data = ['cron' => $cron, 'job' => $job->getPayload()];

        $id = Uuid::uuid4()->toString();

        $key = sprintf('%s:%s', self::CRON_QUEUE_NAME, $id);

        $this->client->set($key, json_encode($data));

        $this->updateCron($id, $cron);
    }
685189
@PostConstruct
  public void setupScheduler() {
    for(SchedulerTask task : tasks) {
      if(task.getDelay() > 0 && task.getInterval() > 0) {
        executor.scheduleWithFixedDelay(task.getTask(), task.getDelay(), task.getInterval(), task.getTimeUnit());
      } else if(task.isImmediate() && task.getInterval() > 0) {
        executor.scheduleWithFixedDelay(task.getTask(), 0l, task.getInterval(), task.getTimeUnit());
      } else if(task.getDelay() > 0) {
        executor.schedule(task.getTask(), task.getDelay(), task.getTimeUnit());
      } else {
        executor.execute(task.getTask());
      }
    }
  }
247236
public function main()
    {
        // log the configured deployment directory
        $this->getSystemLogger()->info('Now start CRON scanner');

        // load the validated and merged CRON jobs
        /** \AppserverIo\Appserver\Core\Api\Node\CronNodeInterface $cronNode */
        $cronNodes = $this->newService('AppserverIo\Appserver\Core\Api\ScannerService')->findAll();

        // execute all the registered CRON jobs
        while (true) {
            // initialize an instance with the current date/time
            $currentTime = new \DateTime();
            // execute each of the jobs found in the configuration file
            /** @var \AppserverIo\Appserver\Core\Api\Node\CronNodeInterface $cronNode */
            foreach ($cronNodes as $cronNode) {
                // execute each of the jobs found in the configuration file
                /** @var \AppserverIo\Appserver\Core\Api\Node\JobNodeInterface $jobNode */
                foreach ($cronNode->getJobs() as $jobNode) {
                    // load the scheduled expression from the job definition
                    $schedule = $jobNode->getSchedule()->getNodeValue()->__toString();

                    // query whether the job has to be scheduled or not
                    if (CronExpression::factory($schedule)->isDue($currentTime)) {
                        $this->getCronJob($jobNode);
                    }
                }
            }

            // sleep for the configured interval
            sleep($this->getInterval());
        }
    }
555467
def activate_crontab(self):
        
        self._crontab = []
        if hasattr(self, 'CRONTAB'):
            for crontab_spec in self.CRONTAB:
                args = cronjob.parse_crontab(crontab_spec)
                job = cronjob.CronJob()
                if args['_timer'] == 'datetime':
                    job.set_triggers(args['trigger_format'], args['trigger_time'])
                if args['_timer'] == 'crontab':
                    job.set_crontab(args['crontab'])
                if args['action'].startswith('.'):
                    action_name = args['action'][1:]
                    action_ = getattr(self.__class__, action_name)
                else:
                    action_ = args['action']
                job.set_action(action_, *args['args'])
                self._crontab.append(job)
        self.start_poller(30, self.poll_crontab)
313935
public function scheduleUpdateProfiles($cron = true)
    {
        $userAccounts = $this->getLocalAccounts();

        if (is_array($userAccounts) & !empty($userAccounts)) {
            $userAccounts = array_chunk($userAccounts, 200);
            foreach ((array)$userAccounts as $index => $userChunk) {
                //Schedule chunks with 1 second apart (minimum cron job trigger).
                if ($cron === true) {
                    if(!wp_next_scheduled('ad_integration_bulk_update_profiles', array('userNames' => $userChunk))) {
                        wp_schedule_single_event(
                            time() + 10,
                            'ad_integration_bulk_update_profiles',
                            array('userNames' => $userChunk)
                        );
                    }
                } else {
                    $this->updateProfiles($userChunk);
                }
            }
        }
    }
101261
public function deleteAll()
    {
        /* @var $schedules Mage_Cron_Model_Resource_Schedule_Collection */
        $schedules = Mage::getModel('cron/schedule')->getCollection();
        foreach ($schedules as $key => $schedule) { /* @var Aoe_Scheduler_Model_Schedule $schedule */
            $schedule->delete();
        }
        Mage::app()->saveCache(0, Mage_Cron_Model_Observer::CACHE_KEY_LAST_SCHEDULE_GENERATE_AT, array('crontab'), null);
        return $this;
    }
859464
public function start()
    {
        $this->logger->info("crontab start");

        $loop = Factory::create();

        // add periodic timer
        $crontab_timer = $loop->addPeriodicTimer(60, array($this, 'crontabCallback'));

        // recover the sub processes
        $loop->addPeriodicTimer(60, array($this, 'processRecoverCallback'));

        $server = new \Jenner\Crontab\HTTP\Server($loop, $this, $crontab_timer);
        $server->start($this->port);

        $loop->run();
    }
273446
def set_job(user,
            minute,
            hour,
            daymonth,
            month,
            dayweek,
            cmd,
            commented=False,
            comment=None,
            identifier=None):
    '''
    
    '''
    # Scrub the types
    minute = six.text_type(minute).lower()
    hour = six.text_type(hour).lower()
    daymonth = six.text_type(daymonth).lower()
    month = six.text_type(month).lower()
    dayweek = six.text_type(dayweek).lower()
    lst = list_tab(user)
    for cron in lst['crons']:
        cid = _cron_id(cron)
        if _cron_matched(cron, cmd, identifier):
            test_setted_id = (
                cron['identifier'] is None
                and SALT_CRON_NO_IDENTIFIER
                or cron['identifier'])
            tests = [(cron['comment'], comment),
                     (cron['commented'], commented),
                     (identifier, test_setted_id),
                     (cron['minute'], minute),
                     (cron['hour'], hour),
                     (cron['daymonth'], daymonth),
                     (cron['month'], month),
                     (cron['dayweek'], dayweek)]
            if cid or identifier:
                tests.append((cron['cmd'], cmd))
            if any([_needs_change(x, y) for x, y in tests]):
                rm_job(user, cmd, identifier=cid)

                # Use old values when setting the new job if there was no
                # change needed for a given parameter
                if not _needs_change(cron['minute'], minute):
                    minute = cron['minute']
                if not _needs_change(cron['hour'], hour):
                    hour = cron['hour']
                if not _needs_change(cron['daymonth'], daymonth):
                    daymonth = cron['daymonth']
                if not _needs_change(cron['month'], month):
                    month = cron['month']
                if not _needs_change(cron['dayweek'], dayweek):
                    dayweek = cron['dayweek']
                if not _needs_change(cron['commented'], commented):
                    commented = cron['commented']
                if not _needs_change(cron['comment'], comment):
                    comment = cron['comment']
                if not _needs_change(cron['cmd'], cmd):
                    cmd = cron['cmd']
                    if (
                        cid == SALT_CRON_NO_IDENTIFIER
                    ):
                        if identifier:
                            cid = identifier
                        if (
                            cid == SALT_CRON_NO_IDENTIFIER
                            and cron['identifier'] is None
                        ):
                            cid = None
                        cron['identifier'] = cid
                if not cid or (
                    cid and not _needs_change(cid, identifier)
                ):
                    identifier = cid
                jret = set_job(user, minute, hour, daymonth,
                               month, dayweek, cmd, commented=commented,
                               comment=comment, identifier=identifier)
                if jret == 'new':
                    return 'updated'
                else:
                    return jret
            return 'present'
    cron = {'cmd': cmd,
            'identifier': identifier,
            'comment': comment,
            'commented': commented}
    cron.update(_get_cron_date_time(minute=minute, hour=hour,
                                    daymonth=daymonth, month=month,
                                    dayweek=dayweek))
    lst['crons'].append(cron)

    comdat = _write_cron_lines(user, _render_tab(lst))
    if comdat['retcode']:
        # Failed to commit, return the error
        return comdat['stderr']
    return 'new'
231342
def _add_jobs(self):
        
        for name, params in self.jobs.items():
            if params.active:
                params.handler = params.handler(params)
                self.sched.add_cron_job(params.handler.run, **params.schedule)