Log in

View Full Version : Run vb cron more often then 10min limit


Ghostt
04-24-2014, 06:17 PM
is there a possiblity to run vb cron more often like every 2 min?
like pluggin or code change?

kh99
04-24-2014, 07:11 PM
You should be able to edit a scheduled task and have it run every minute. I don't think you can have it run every two minutes because the only options are to have it run every minute or to select up to 6 times during the hour.

tbworld
04-24-2014, 07:14 PM
A CRON process/task scheduler is not run on a timer but when a user requests a new page. If no one is on the board requesting new pages from the server, the CRON process/task scheduler does not run.

You would have to use a timer task from your server. There are several threads on the subject here on vBulletin.org.

Zachery
04-24-2014, 07:46 PM
Why are you trying to run something that often?

Ghostt
04-24-2014, 08:39 PM
its a custom plugin and need to run at least every 3-5 min.
in vb cron you can set up min. every 10 min. this is the problem.


If no one is on the board requesting new pages from the server, the CRON process/task scheduler does not run.

i know that and this is no problem its a big board.

Zachery
04-24-2014, 09:00 PM
Again, why does it need to run that often?

tbworld
04-24-2014, 09:34 PM
I have not dug into the semiphoric nature of the vbulletin cron system that deeply as I run my tasks via the server. My guess if the time is set too little there might be timing issues, possibly race conditions.

As @Zachery asked, if we knew what you were doing, we could be of more assistance. :)

Most of the cron code is in 'functions_cron.php'.

kh99
04-25-2014, 07:38 AM
If you've written your own custom cron task script, you could set it to run every minute then have it check a "last run" time so that it only does the actual work every 3 or 5 minutes. (You'd have to save your own last run time in the database, maybe by using the datastore).

Ghostt
04-25-2014, 01:20 PM
yes own cron is a complicated solution, but maybe just run it with server cron? or not possible.

Zachery
04-25-2014, 03:14 PM
You still really haven't, told us why it needs to run so often?

Ghostt
04-25-2014, 03:20 PM
i dont have to tell you.

Zachery
04-25-2014, 03:33 PM
I can't think of anything that would need to be run so often, nor why it would be so direly important to run it that often.

If it really is, setup a traditional cron or task via your OS to operate it outside of vBulletin

Lynne
04-25-2014, 07:42 PM
Don't you mean this to be 30 like this?

Replace with this:

for ($x = 0; $x < 30; $x++)

tbworld
04-25-2014, 08:29 PM
Don't you mean this to be 30 like this?

Yes... I was stll editing when you posted, but of course thanks. I have really never used these editors correctly. I compose online and keep re-saving until I correct the text. I must drive you admins mad, sorry about that. :)

I always appreciate the help. :)

--------------- Added 25 Apr 2014 at 14:40 ---------------

Ghostt
05-19-2014, 10:39 PM
Don't you mean this to be 30 like this?


Replace with this:

PHP Code:
for ($x = 0; $x < 30; $x++)



what you mean with that code where to put ?
does anyone has a solution?

Zachery
05-19-2014, 10:53 PM
Chances are if you need the cron to run more often, there is a better way to do what you want. thus why I am asking.

tbworld
05-19-2014, 11:10 PM
I will PM you a patch when I have the time today. I do have to agree with @Zachery, as this is most likely not the best way to be handling your event. I deleted the code from the thread as I believe it gives users the wrong concept about handling time sensitive events.

Zachery
05-19-2014, 11:32 PM
If you really, REALLY need it to run more often than 5 min, then making sure there is traffic on your board is going to be a bigger concern. Not to mention it could cause problems if you're running it so often other requests can't get processed for some reason.

The system cron jobs, or scheduled tasks would be better. That or just calling your code outside of the cron all together on every page load.

Ghostt
05-19-2014, 11:42 PM
Its about a cron for threads import and its temporary needed.
so runing it for a period of time every 2 min is ok.
thank you tbworld for the code, but is it safe to use or can cause problems?
or is there a easyer way to run it on server cron or so

tbworld
05-19-2014, 11:48 PM
Its about a cron for threads import and its temporary needed.
so runing it for a period of time every 2 min is ok.
thank you tbworld for the code, but is it safe to use or can cause problems?
or is there a easyer way to run it on server cron or so

As I stated in the code I sent you: it has not been stressed tested on different server setups, so you are using at your own risk. The code was tested for functionality and limited mufti-threaded testing.

Ghostt
05-20-2014, 12:02 AM
ok i will check it first on the testboard.

tbworld
05-20-2014, 12:19 AM
Just noticed that this thread is for vb3, the code I posted was for vb4. However, the code I sent you via PM is probably similar.