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

Reply
 
Thread Tools
Execute Scheduled Tasks Via Crontab Details »»
Execute Scheduled Tasks Via Crontab
Version: 1.00, by Jafo232 Jafo232 is offline
Developer Last Online: Oct 2022 Show Printable Version Email this Page

Category: Administrative and Maintenance Tools - Version: 3.6.8 Rating:
Released: 12-05-2007 Last Update: Never Installs: 66
Uses Plugins
Additional Files  
No support by the author.

This product will run your scheduled tasks via crontab rather than the current method where Vbulletin uses an image to execute tasks. This can slow down a users experience especially with long running tasks. It also stops all of those cron.php entries in your webserver log.

This product is really only useful for those on *nix (Linux/Unix/Etc) servers. Will not work on Windows based servers.

You should have a rudimentary understanding of crontab before installing this hack.

For those wondering how this differs from this hack, well, first of all, it works for 3.6.8, but more importantly it actually replaces the method Vbulletin uses to execute scheduled tasks, whereas the other hack only helps it out.

Please Click Install!


Brought To You By WorldWideCreations.com.

Show Your Support

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

Comments
  #12  
Old 03-18-2008, 01:38 PM
Jafo232 Jafo232 is offline
 
Join Date: May 2004
Posts: 1,122
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Don't see why it wouldn't, but I for one will not modify any plugin for a beta. When it is released, then I consider it.
Reply With Quote
  #13  
Old 03-28-2008, 02:14 AM
GoodKarmaKid GoodKarmaKid is offline
 
Join Date: Nov 2005
Location: Las Vegas, NV
Posts: 42
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Jafo232 View Post
Don't see why it wouldn't, but I for one will not modify any plugin for a beta. When it is released, then I consider it.
Do you consider RC1 (release candidate 1) a release ? .


I like the idea of using this instead of vbulletins built in cron tasks.


Thanks,
Jason
Reply With Quote
  #14  
Old 03-28-2008, 01:18 PM
Jafo232 Jafo232 is offline
 
Join Date: May 2004
Posts: 1,122
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

No I don't consider it a release. You are always free to try it yourself.
Reply With Quote
  #15  
Old 03-30-2008, 03:31 PM
Jafo232 Jafo232 is offline
 
Join Date: May 2004
Posts: 1,122
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Unless they have seriously changed the way scheduled tasks are done, I don't see how it would not work in the latest beta versions.
Reply With Quote
  #16  
Old 12-15-2008, 05:20 PM
|Jordan|'s Avatar
|Jordan| |Jordan| is offline
 
Join Date: Nov 2004
Posts: 479
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Can this increase server load? My webhost just contacted me saying that cron.php among other scripts were using too much cpu.
Reply With Quote
  #17  
Old 12-16-2008, 01:44 PM
Jafo232 Jafo232 is offline
 
Join Date: May 2004
Posts: 1,122
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by |Jordan| View Post
Can this increase server load? My webhost just contacted me saying that cron.php among other scripts were using too much cpu.
Not this mod. This mod just calls cron.php just like it normally would except on an exact schedule. It could be you have a scheduled task that is using a lot of CPU though.
Reply With Quote
  #18  
Old 01-15-2009, 04:53 PM
plothook plothook is offline
 
Join Date: Apr 2007
Posts: 13
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I have been using this mod for quite some time (clicked install over a year ago) now, and always lived with vBulletin cron tasks running one at a time when the linux cron ran once a minute.

But last week I got ambitious and dug into the bash shell to write this script that runs all the tasks scheduled for any any particular minute, instead of allowing them to sit in 'backlog' until the next minute.

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
  #19  
Old 04-08-2009, 01:17 AM
OnyxChase OnyxChase is offline
 
Join Date: Jul 2007
Posts: 79
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Why not just use:

/usr/bin/php /home/username/public_html/forum/cron.php >& /dev/null

???
Reply With Quote
  #20  
Old 04-08-2009, 05:45 AM
Jafo232 Jafo232 is offline
 
Join Date: May 2004
Posts: 1,122
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Because then you are still displaying the cron.php image..
Reply With Quote
  #21  
Old 04-08-2009, 06:37 AM
OnyxChase OnyxChase is offline
 
Join Date: Jul 2007
Posts: 79
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ah, I understand what you are saying. But I still think it is better to call the /usr/bin/php directly rather than using a .SH script that does the exact same thing.

But of course, the product XML would have to be loaded to remove the $cronimage from displaying.
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 04:40 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04469 seconds
  • Memory Usage 2,305KB
  • Queries Executed 25 (?)
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
  • (1)bbcode_code
  • (2)bbcode_quote
  • (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
  • (2)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)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