Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.

Go to the System → Logs → Scheduled Tasks

AbanteCart supports the creation of scheduled tasks.

Table of Contents

These tasks can be of two types - with immediate execution and deferred.

Tasks options

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)

The 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

Tasks Steps

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 task

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 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) 

cd your_abantecart_directory

Run this command. 

php task.php

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. 

titlegeneral example

* * * * * /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 > >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.

titleCrontab shell

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