Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.6 > vBulletin 3.6 Add-ons

Reply
 
Thread Tools
Schedule vB's tasks with a host crontab Details »»
Schedule vB's tasks with a host crontab
Version: 1.00, by Nxs Nxs is offline
Developer Last Online: Feb 2011 Show Printable Version Email this Page

Category: Administrative and Maintenance Tools - Version: 3.6.0 RC3 Rating:
Released: 07-30-2006 Last Update: Never Installs: 24
Additional Files  
No support by the author.

Schedule vB's tasks with a host crontab

!!! Warning You run this script at your OWN risk, I will not be responsible for any damage caused !!!

Description:
vBulletins schedule tasks only run when a user is browsing your forum. With the release of 3.6 and RSS imports this has caused problems for slow moving forums importing fast moving RSS feeds (If a news item passes fully through the RSS feed before a visitor browses your forums causing the import to be processed then content could be lost)
Solution:
If your host supports "Cron Jobs" you can call the attached PHP file periodically to force vBulletin to catch up with its internal scheduled tasks.
Installation
  1. Download the attached file and edit the variables at the top to match your forum installation
  2. Upload the file to somewhere on your host
  3. Schedule this file to run at an appropriate interval
eg. (to run every hour at 15m past the hour, 12:15 - 13:15 - 14:15 - etc.)
Code:
15 * * * * /usr/bin/php -f /home/myuser/exec-cron.php >/dev/null 2>&1
Detailed Information
Unfortunatly running the cron.php from the vBulletin files will only process the next pending single task, This short script simply queries the scheduled task database to count how many tasks are pending, it then calls the cron.php routine that number of times - thus your scheduled tasks are kept up to date.

This is my first ever PHP script so please don't expect a masterpiece from a rocket scientist, if anyone has any comments or suggestions please drop me a PM

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #12  
Old 08-09-2007, 09:21 PM
jmw jmw is offline
 
Join Date: Jan 2005
Posts: 71
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Doesn't work with vbulletin 3.6.8
Reply With Quote
  #13  
Old 07-07-2008, 02:41 PM
OmniBuzz OmniBuzz is offline
 
Join Date: Nov 2006
Posts: 56
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

any chance to have an update for the latest release of Vbulletin ?
Reply With Quote
  #14  
Old 08-03-2008, 09:29 PM
trilljester's Avatar
trilljester trilljester is offline
 
Join Date: Jul 2005
Posts: 151
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yeah, I can't seem to get it to work anymore. Sad, but I'm uninstalling. I'll have to write a shell script or something to trigger the cron in VB every 15 minutes or something.
Reply With Quote
  #15  
Old 08-12-2008, 07:42 PM
Quarterbore Quarterbore is offline
 
Join Date: Mar 2005
Location: Valley Forge PA
Posts: 538
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I need something like this for my Devopment board where I need to test but there are no users to make the scripts work. I will see if I can get it working on my 3.6.x site.
Reply With Quote
  #16  
Old 06-19-2009, 08:09 PM
plothook plothook is offline
 
Join Date: Apr 2007
Posts: 13
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This works for me using vB 3.8.3

save the code below into a script file named vbcronjob.sh, and call the script from cron (I schedule my crontab for once a minute). Be sure to chmod +x the script. The logic in this shell script is pretty much the same as in the cron-exec.php script you can download here.

you should also disable the cron image inserted at the bottom of the pages presented to your users. See This Mod for a simple plugin to do that.
Code:
#!/bin/bash

#----- environment setup -----#
# Absolute path to vBulletin root (where cron.php is located)
ct_pathtoforum='/home/user/public_html/forum/'
# Max tasks to run on one pass
ct_max=10

#----- database setup -----#
ct_dbhost='localhost'     # your MySQL Server
ct_dbport='3306'          # your MySQL Port
ct_dbname='forum'         # your vBulletin database
ct_dbuser='username'      # user with READ access
ct_dbpass='password'      # password for the above user
ct_dbprefix=''            # database prefix, if required

#----- query execution ----#
ct_date=`date "+%s"`      # current unix time
ct_connect="--protocol=socket -h$ct_dbhost -P$ct_dbport -u$ct_dbuser -p$ct_dbpass -D$ct_dbname"
ct_query="SELECT COUNT(*) FROM ${ct_dbprefix}cron WHERE active=1 AND nextrun < $ct_date;"
# -A, No automatic rehashing, gives quicker start.
# -B, Batch mode.
# -N, Don't write column names.
# -n, Flush buffer.
# -q, Don't cache.
# -r, Write raw fields.
# -e, Execute command and quit.
ct_repeat=`mysql $ct_connect -A -B -N -n -q -r -e"$ct_query"`

#----- cron execution ----#
ct_pathtophp=`which php` # path to PHP
cd $ct_pathtoforum
if [ "$ct_repeat" -gt "$ct_max" ]; then ct_repeat=$ct_max; fi
for ((i=0; ct_repeat>i; i++)); do
#echo "$i"
$ct_pathtophp ./cron.php >& /dev/null
sleep 5
done

exit 0
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 02:44 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04656 seconds
  • Memory Usage 2,249KB
  • Queries Executed 20 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (2)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (6)post_thanks_box
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (6)post_thanks_postbit_info
  • (5)postbit
  • (6)postbit_onlinestatus
  • (6)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete