Announcement
Collapse
No announcement yet.
New Feature: Scheduled Tasks By File In vB 5.3.4
Collapse
X
-
Scheduled tasks are queued in vBulletin. Running vb_cron.php will trigger a queued script and run it until its completion. Triggering it again shouldn't affect scripts already running. However, you may end up with a number of scheduled tasks running at once. Though this should still use fewer resources than triggering the tasks from the web interface with a page load.
-
Think, that is too often, because some cron jobs needs more than 10 seconds to be done. Trigger cronjob every minute one time is enough. You should ask Wayne Luke for.
-
So I'm about 3 years late in answering this, but hopefully my addition will help someone.
Here's my crontab file:
Code:SHELL=/bin/bash PATH=/sbin:/bin:/usr/sbin:/usr/bin MAILTO=root # For details see man 4 crontabs # Example of job definition: # .---------------- minute (0 - 59) # | .------------- hour (0 - 23) # | | .---------- day of month (1 - 31) # | | | .------- month (1 - 12) OR jan,feb,mar,apr ... # | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat # | | | | | # * * * * * user-name command to be executed 0 23 * * * root some task 1 1 * * * root some task 5 1 * * * root some task MAILTO="" * * * * * root php /root/scripts/xx-vbcron.php > /dev/null * * * * * root ( sleep 15 ; php /root/scripts/xx-vbcron.php > /dev/null ) * * * * * root ( sleep 30 ; php /root/scripts/xx-vbcron.php > /dev/null ) * * * * * root ( sleep 45 ; php /root/scripts/xx-vbcron.php > /dev/null ) * * * * * root php /root/scripts/aa-vbcron.php > /dev/null * * * * * root ( sleep 15 ; php /root/scripts/aa-vbcron.php > /dev/null ) * * * * * root ( sleep 30 ; php /root/scripts/aa-vbcron.php > /dev/null ) * * * * * root ( sleep 45 ; php /root/scripts/aa-vbcron.php > /dev/null )
Notice the > /dev/null at the end - this stops the logs from getting full of stuff I don't care about.
The vbcron has been renamed since I have multiple websites on this server, I need to have one per domain because I have to give each script the path to my core for that domain.
The sleep delays each instance by 15 seconds so I run 4 per minute per domain. This is no more resources than online users in your forum switching pages once/15-seconds.
If your site is really busy you won't need this, but for a site that's just starting up this works very well.
You can adjust the times to do every 30-seconds instead of every 15 - whatever is good for your needs.
BTW: This works in v5.5.6 without issue.
I hope this helps some of you.Last edited by cybergods; Sun 9 Feb '20, 12:33pm.
-
Thats a valuable information. So I do turn off scheduled tasks, because I also run vbcron by cronjob. I can say, that's a lot better, because all my scheduled tasks are running now quite fine.
-
Just FYI...I confirmed with Kevin at http://tracker.vbulletin.com/browse/VBV-17997 that you can optionally turn off the cron AJAX call if you set up the external vbcron.php. It's at AdminCP > Settings > Options > Server Settings and Optimizations Options > Enable Scheduled Tasks. That option only affects the cron AJAX call and the system cron will still be able to run all the active tasks according to schedule.
Leave a comment:
-
You should not touch the scheduled tasks in the AdminCP. All vbcron.php does is trigger the API to run the scheduled tasks as they are defined in the AdminCP. It simply removes the need for someone to visit your site every minute to run them regularly.
On the server level, you just need to set up a crontab to run php /path/to/vbcron.php.
- Likes 2
Leave a comment:
-
But that file seems to check, if cron jobs are enabled in AdminCP. I'll ask that in official release discussion topic. https://www.vbulletin.com/forum/foru...ase-here/page3
Leave a comment:
-
Originally posted by BulliM View PostThank you In Omnibus, that will help me.
Looks like this file runs all available cron jobs. So should I deactivate scheduled tasks by php in AdminCP ?
It would seem like if you run a cron job from vbcron.php you should turn off the same cron job in the admincp.
Leave a comment:
-
Thank you In Omnibus, that will help me.
Looks like this file runs all available cron jobs. So should I deactivate scheduled tasks by php in AdminCP ?
Leave a comment:
-
It's vbcron.php located in the "Do Not Upload" folder. The instructions are included in the file itself.
1. Copy the script to your webserver. Preferable outside of the webroot directory.
2. Set the $core variable to the path to your vb core directory
3. Add an entry to your system cron to run the script (recommend running every minute)
/path/to/php /path/to/file/vbcron.php
- Likes 1
Leave a comment:
-
New Feature: Scheduled Tasks By File In vB 5.3.4
Today I'll upgrade vB to 5.3.4, In announcement you inform about an added file for scheduled tasks.
Added an external file that allows the running of Scheduled Tasks via the server's cron/scheduled task system. This will allow separation of these tasks from the web server.- What is this file named?
- Can you please show an example, how to use it?
Tags: None
Related Topics
Collapse
-
I have a use case that I need to run vb scheduled task in CLI. How to do it?
-
Channel: Support Issues & Questions
Tue 10 Apr '18, 10:16am -
-
by RobbobI hope this is in the right spot. Im trying to setup the vb_backup.sh included in the do_not_upload folder and set up a Cron job to automatically back it up for me.
But Im truly lost on what...-
Channel: Support Issues & Questions
Fri 18 Sep '20, 4:43pm -
-
by BulliMI use 'vbcron.php' * for the cronjobs in our forums. At full hours (eg. 1.00, 12.00) server have a PHP load of almost 100%. This results in pages are loaded slowly. I cannot explain, why this happens....
-
Channel: Support Issues & Questions
Thu 20 Jun '19, 2:31pm -
Leave a comment: