These tasks 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:
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)
The table is also used for the extended properties task_details in which:
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 a result. In addition, the table must specify RT controller performing step. For example: task / tool / backup / backupfiles
Also in the table present the 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 failedfailure. In other words, successfully completed the task, this task is complete all the steps successfully.
Running tasks can occur in two ways.
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
The launch of the UI (meaning immediately start the event, such as clicking a button).
Functions hang an event on an element with the css-class "task_run". Also, this element must be two custom attributeattributes: 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 the successful completion of the task.
As an example of creating and launching an urgent job, see the button. Admin → Data → Backup → “Backup now”.
To see examples of the data in the database tables described above, click Admin → Data → Backup → "Schedule backup".
Scheduling tasks and running the command line
If you like to process tasks on in the background of your server, you need to have access to your server shell or the ability to set up crontab.
In the shell, you need to go to the AbanteCart directory (same director with index.php)
Run this command.
to run all tasks needs to run command
task_cli.php run --force-all
To run tasks automatically based on a set schedule, you need to set up a crontab in your server to run the above script.
Most hosting control panels offer a cron schedule or you will need to do it directly on your server
|NOTE: Do not set this crontab process more often than 10min intervals. If you have very heavy tasks, you might need to manage scheduling specifically for your processes. If you schedule them to run too often, the server could start another cron job before the last cron job ends. This duplication may degrade performance.|
crontab in Linux
Run command crontab -e with the same Linux user running a web server for the AbanteCart
In the editor add the below line with the correct path to your application directory
*/10 * * * * php [your_abantecart_directory]/task_cli.php > [your_abantecart_directory]/system/logs/tasks.log 2>&1
For enabling cron under a shared hosting account, please contact the hosting company or their manuals.
configure cPanel Cron
Login to your cPanel and go to cPanel >> Home >> Advanced >> Cron Jobs.
Scroll to the Add New Cron Job form
Enter the desired intervals for the cron job that you wish to configure. For more information, read the cPanel Cron job intervals doc.
Make sure to specify the absolute server path to the file that you wish to run.
* * * * * /usr/bin/php /home/user/public_html/task_cli.php > /home/user/public_html/system/logs/tasks.log 2>&1
schedule task in Plesk UI
- Log in to Plesk
- Go to Websites & Domains > example.com >Scheduled Tasks
- Click Add task
- Create a task with the type Run a command and specify the full path to the PHP executable. Specify other settings if required.
Based on your server configuration you may need to go to the Tools & Settings > Scheduled Tasks > Settings and set the option Crontab shell to /bin/bash