![]() |
Scheduled Task - Run Every 5 Seconds
I've created a Scheduled Task that will submit a request to an API and store the value returned in a table in my database.
I'm interested in having this Scheduled Task run every 5 seconds, yet in the vB3 AdminCP, the only fields I see are Day of the Week, Day of the Month, Hour, and Minute. However, Minute has 6 fields attributed to it, which I am also confused about. How would I get my Scheduled Task to run every 5 seconds through vBulletin? Thanks, Mark |
There are 6 "minute" fields because you can schedule a task to run up to 6 times per hour at certain minutes of the hour. If you choose '*' then it will run once per minute, but that's the most often you can schedule a task to run (unless you modify the code somehow).
I'm assuming that you're using the returned value somewhere, maybe you could do something like before it's displayed check to see if it's more than 5 seconds old, and if it is, request it before displaying it. But then I guess you'd also need a way to keep it from constantly being requested by multiple threads, especially if you have a very busy site, |
Quote:
Would the following settings be what I'm after if I wish to have my Task run every minute? https://vborg.vbsupport.ru/external/2014/12/20.png |
Yes, I believe that would do it.
But in case you're not aware, the tasks run when users view your forum pages, so the timing it approximate, and it will only run once per minute if you have enough traffic to your site. |
That should do it. Be aware that the Scheduled Tasks only run if you have users on your site. The tasks will backup if you don't have people clicking on your site.
|
I see! Thanks for the information.
As a follow-up question... I have a custom bridge I developed with vB. Since both you reminded me how a user needs to be viewing the forum in order for Scheduled Tasks to execute, I decided to generate $cronimage in my site-wide header (not present on my directory with my vBulletin files) so that Scheduled Tasks hopefully would execute even if nobody is viewing the Forum Index. Here is what I included (community/ is the directory where I have my vBulletin): PHP Code:
Thanks again! |
It seems right, but to be honest I don't know for sure.
|
Yeah it looks ok to me also. But I don't understand, what is it you need to run so often?
|
Quote:
Anyways, good to see that the code I added in the header looks OK. Thanks for all the help! :) |
Gotcha. Glad to see you found a way to do what you wanted though. :)
|
Quote:
|
This is true, unless of course it is a custom page, and you did not include the footer on it. :)
|
Please let me know, I've set up a cron to run every minute as above. If no one is accessing the site, the cron does not run?
|
Quote:
|
I have search more one 1h in vb.com but not find :(
|
Quote:
Quote:
Try as Kevin suggested and setup an actual cron in cpanel versus vBulletin, when you set it up to run from cpanel it will run every minute whether your site has someone on it or not UNLESS the server restarts or has an issue but generally should not. https://documentation.cpanel.net/display/ALD/Cron+Jobs |
Cron can run when google bot visit?
|
Quote:
There is no guarantee on it running from vBulletin cron unless activity is ALWAYS present on the site, this is why we mentioned running cron from cpanel. |
All times are GMT. The time now is 05:53 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|