Download the PHP package qrotux/phalcon-cron without Composer
On this page you can find all versions of the php package qrotux/phalcon-cron. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package phalcon-cron
Sid\Phalcon\Cron
Cron component for Phalcon.
Installing
Install using Composer:
You'll also need to add the console
to the DI:
Example
Crontab
DI
CLI Task
Foreground Versus Background
Running jobs in the foreground (sequential):
Job1 -------->
Job2 ----------------->
Job3 ---->
Running jobs in the background (parallel):
Job1 -------->
Job2 ----------------->
Job3 ---->
For most applications it is recommended to use ->runInBackground()
as this is typical of a Cron implementation and is often quicker. If you specifically need to access the output of each Cron Job, use ->runInForeground()
.
->runInBackground()
returns an array of Process instances. ->runInForeground()
returns an array of outputs.
Waiting, Terminating And Killing
By default all background processes register a shutdown function that forces the PHP script to wait for job to complete before shutting down. You can call ->wait()
on a Process instance if you need to wait until it has finished.
You can also use ->terminate()
and ->kill()
on a Process to send terminate and kill signals.
->wait()
, ->terminate()
and ->kill()
are also available on the Manager instance and will wait for, terminate or kill every process.
Running Jobs At A Custom Time
You can see which Jobs are due at a particular time by passing a \DateTime
to ->getDueJobs()
:
You can also pass a \DateTime to ->runInForeground()
/->runInBackground()
to run jobs due at that particular time.
Adding Jobs From A Crontab
You can also add jobs from a Crontab file, such as this one:
To get an array of System Job instances from the Crontab: