Can we configure the cron runtime through a PHP script?

Can we set the time interval for cron to work through the PHP script so that the time interval is not set manually, and through the PHP script, is the time interval required from the database or fixed (but inside the PHP code).
thanks in advance

+5
source share
5 answers

I think it is much better to let your application control the frequency of events instead of cronjob. Let cronjob run a specific action of your application every minute. Then the action then checks the database table named cronjobs and starts the jobs that are marked to run with either a frequency number or a timestamp.

, , . cronjob. , .

+3

. crontab , cron. ​​ script.

+2

, , PHP script, system().

0

, PHP script, crontab ( script ).

.

cron , cron. , timed-execute PHP (.. ).

, Scheduler -interface, script, , . cron linux, - Windows:

interface Scheduler {
  function schedule($script);
}
class CronScheduler {
  function schedule($script) {
    append_cronjob($script);
  }
}

.

0

If you want to do this, I suggest you use Message Queue Beanstalkd instead . It can do delayed software and is very fast. I advise you to use pheanstalk to talk with Beanstalkd.

0
source

All Articles