Scheduled Task pattern

A scheduled task fundamentally consists of three things: the task itself, the jobs that do the scheduling by defining when the task that is being run and when it is permitted to run, and finally, the job registry that executes this job.

Commonly, these are implemented by using cron on Linux servers. You add a line to the configuration file using the following configuration syntax:

     # ┌───────────── min (0 - 59)
     # │ ┌────────────── hour (0 - 23)
     # │ │ ┌─────────────── day of month (1 - 31)
     # │ │ │ ┌──────────────── month (1 - 12)
     # │ │ │ │ ┌───────────────── day of week (0 - 6) (0 to 6 are Sunday to
     # │ │ │ │ │                  Saturday, or use names; 7 is also Sunday)
     # │ │ │ │ │
     # │ │ │ │ │
     # * * * * *  command to execute

You can ordinarily ...

Get Mastering PHP Design Patterns now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.