Scheduled Tasks list
System > Logs > Scheduled Tasks
Starting with version 1.2.0 WebriQshops support the creation of scheduled tasks.
These task can be of two types - with immediate execution and deferred.
Each task has its own properties, which are stored in a database table tasks.
These properties include:
- task_id
- name - a unique name for the job
- starter - user_id of the user who has the right to run the task (top-administrator has it always)
- status - status
- start_time - task start time
- last_time_run - the last task start
- progress - the percentage of completion
- last_result - 0 - success, 1 - failed
- run_interval - start task interval in seconds.
- max_execution_time - the maximum duration of the task (not available yet)
Table is also used for the extended properties task_details in which:
- task_id
- created_by - the name of the one who created the task
- settings - abstract serialized array with additional task settings
Each task consists of steps. A description of each step is stored in the database table task_steps. As the task, each step has a status sequence number, the last run time and result. In addition, the table must specify RT controller performing step. For example: task / tool / backup / backupfiles
Also in the table present settings column in which should be recorded the serialized array. This array can be as arguments to functions and additional information on the launch step. For example interrupt_on_step_fault set to true or 1 will stop the execution of the remaining steps of the job, if the execution of the step failed.
In cases where the execution of at least one of the listed task steps fails, the task is generally considered a failed. In other words, successfully completed task, this task is complete all the steps successfully.
Running tasks can occur in two ways.
-
1
console launch script task.php (from cron). task.php receive a list of all waiting tasks, then sort all in order and run in the background
-
2
The launch of the UI (meaning immediately start the event, such as clicking a button).
In the template admin file public_html / admin / view / default / javascript / general.js there are several js-functions for starting task, opening a modal window and display the start process steps.
Functions hang event on an element with the css-class "task_run". Also, this element must be two custom attribute: data-run-task-url (url to which js-script gets the job description and all the steps in the json-format to run in a loop) and data-complete-task-url - URL, which will be forwarded to the browser after successful completion of the task.
As an example of creating and launching an urgent job, see button. Admin > Data > Backup > “Backup now”.
To see examples of the data in the database tables described above, click Admin > Data > Backup > "Schedule backup".