MyBB Community Forums

Full Version: the task manager run times still puzzle me
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
the task manager run times has always been a bit puzzling to me. either the times are several hours off or days behind. I'm not sure what's going on here...is something not configured correctly? is there a bug?

I'm using Omar's fork of the remember us plugin found here: http://community.mybb.com/thread-170254.html

here's how the task is configured to run (had to snip it into 2 photos since it all wouldn't fit on 1 screenshot):

[Image: 8ohjvni.jpg]
[Image: a6paaJI.jpg]

and then task manager itself:
[Image: re7ZzK1.jpg]

notice that there are several tasks, including the remember us task, that are several days behind. at the time of me posting this thread, it's 5/6/15 @ 1:40 am EST. my server is set for EST and the board is configured to use EST.

what's going on here?! Huh
The way the task manager works is a bit odd.

When a user hits a page, the task manager starts up. It finds the first task that is past its due time (with the earliest due time), and runs it as long as it isn't locked (currently in progress).

I normally advise running tasks that occur often via Cron personally. This removes the requirement for anybody to load any front end pages and allows you to be sure tasks will run when required. There's support for Cron built in to the task system, as you can pass a specific ID to it to run a single task.
(2015-05-06, 06:38 AM)Euan T Wrote: [ -> ]The way the task manager works is a bit odd.

When a user hits a page, the task manager starts up. It finds the first task that is past its due time (with the earliest due time), and runs it as long as it isn't locked (currently in progress).

I normally advise running tasks that occur often via Cron personally. This removes the requirement for anybody to load any front end pages and allows you to be sure tasks will run when required. There's support for Cron built in to the task system, as you can pass a specific ID to it to run a single task.

how would I set it up so it ran without being part of the task manager?

Can I use a standard crontab in *nix to run the specific task file?
Yeah, you can set it up to act like the usual task management system or to run a certain task. For example:

php /path/to/forum/task.php

When used in a Cron job will just run the next available task. To run a task with ID 9 (you will have to lookup the task IDs in the tasks table in MySQL), just add the ID to the end:

php /path/to/forum/task.php 9
(2015-05-07, 07:59 AM)Euan T Wrote: [ -> ]Yeah, you can set it up to act like the usual task management system or to run a certain task. For example:


php /path/to/forum/task.php

When used in a Cron job will just run the next available task. To run a task with ID 9 (you will have to lookup the task IDs in the tasks table in MySQL), just add the ID to the end:


php /path/to/forum/task.php 9

thanks.  I shall test it out shortly.
just an FYI for anyone who sees this thread and finds it useful in the future: you can find the TID by visiting the task manager in the admin cp and hovering over the task name. you should see the TID in the url like so: http://yoursite.com/admin/index.php?modu...edit&tid=2
Yep, I forgot about that. Probably easier than looking it up in phpMyAdmin.
Just a short notice when you use crontab: don't simply use php but the full path (like /usr/bin/php).

If you don't know the path to your php executable, you can do which php in console.
Euan,

This might be worthy of a tutorial, eh?

as an aside, isn't it also more efficient to run jobs with cron? I've been considering moving all of the tasks to cron.
Yep, it probably is. I'll write one today.

Running the tasks via Cron should be more efficient, yes. It also guarantees they'll be ran. I'd advise it for any board, definitely.