AbanteCart Community

eCommerce construction => How-to questions => Topic started by: dhigz on November 01, 2020, 03:33:56 PM

Title: Task Manager Configuration
Post by: dhigz on November 01, 2020, 03:33:56 PM
Hi,

Working on a new extension that requires the creation and execution of two tasks. This is the first time I have created a task and I understand the idea is to call the task.php file by way of Crontab which will then run all of the tasks in the tasks in the tasks table. My question concerns the frequency of each task.

One of my new tasks need to run every hour while the other needs to run once a day. Reading the documentation and looking at the existing tasks, there are no examples of setting different run times. I do see the 'run_interval' value in the addTask array but this is described as "interval in seconds since last run" in the documentation.

How do you suggest I solve my problem with two tasks to be run at different run times?

Don
Title: Re: Task Manager Configuration
Post by: dvagner on November 02, 2020, 04:13:50 AM
You can add 2 different tasks and run it from cron as 2 record in cron

php task_cli.php run --task_id=1 --force
php task_cli.php run --task_id=2 --force
....
Title: Re: Task Manager Configuration
Post by: maxter on November 02, 2020, 06:21:17 AM
Check Task manuals :
Tasks:
https://abantecart.atlassian.net/wiki/spaces/DOC/pages/18972714/Tasks+API
Sheduling Tasks:
https://abantecart.atlassian.net/wiki/spaces/AD/pages/15007901/Scheduled+Tasks
There is a cron example how to shedule taks.
Title: Re: Task Manager Configuration
Post by: dhigz on November 02, 2020, 12:17:18 PM
Thanks dvagner.

I will give it a try.