job_class
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
job_class [2021/02/11 12:59] – Concept of server job sahl | job_class [2023/06/27 07:30] (current) – sahl | ||
---|---|---|---|
Line 8: | Line 8: | ||
===== Scheduling a job ===== | ===== Scheduling a job ===== | ||
- | A job is basically a function in a class and can be scheduled like this: | + | A job is basically |
+ | |||
+ | ==== Running at a specific interval ==== | ||
+ | |||
+ | A job can run in a specific interval. For example the following code will ensure that the function '' | ||
<code php> | <code php> | ||
Line 15: | Line 19: | ||
</ | </ | ||
- | This will ensure that the function '' | + | ==== Running once (at a specific time) ==== |
- | Another way to schedule | + | This will schedule |
<code php> | <code php> | ||
$job = Job:: | $job = Job:: | ||
- | $job-> | + | $job-> |
$job-> | $job-> | ||
</ | </ | ||
- | This will schedule | + | If // |
- | The key to a given job is the class and the function (and the instance it is running from). So when you use '' | + | ==== Running daily (at a specific time) ==== |
+ | |||
+ | This will schedule the job to run daily at the given date and time. | ||
+ | |||
+ | <code php> | ||
+ | $job = Job:: | ||
+ | $job-> | ||
+ | $job-> | ||
+ | </ | ||
+ | |||
+ | ==== Running always (daemon job) ==== | ||
+ | |||
+ | This will start the given job if it isn't already running. If the job exits, it will be started again ASAP. | ||
+ | |||
+ | <code php> | ||
+ | $job = Job:: | ||
+ | $job-> | ||
+ | </ | ||
===== Running a job ===== | ===== Running a job ===== |
job_class.1613048358.txt.gz · Last modified: 2021/02/11 12:59 by sahl