Follow vBSEO on Twitter
vBulletin Modifications
  • Forums
  • Add-Ons
  • Template Modifications
  • Styles
  • Graphics
  • Tutorials
  • Support Center
  • Register
  • vBulletin SEO

Member Log In

Site Navigation

  • Register
  • Members List
  • Social Groups
  • Search
  • Today's Posts
  • Mark Forums Read

Latest Modifications

  • [vB 3.6.x] StopSpam
    By: flappi282
  • [vB 3.8.x] vBulletin Chat Addon for...
    By: 123flashchat
  • [vB 3.5.x] 404 Page Redirect To...
    By: Ak Worm
  • [vB 3.8.x] 404 Page Redirect To...
    By: Ak Worm
  • [vB 4.0.x] 404 Page Redirect To...
    By: Ak Worm

Latest Template Mods

  • [vB 3.8.4] Images PassWordBox...
    By: cRs!MP
  • [vB 3.8.4] Footer Follow Ups
    By: Ak Worm
  • [vB 3.7.2] Worldofwarcraft blue...
    By: Mikeyodesigns
  • [vB 3.7.0] My Links
    By: blind-eddie
  • [vB 3.7.0] Pop-Up Warning Before...
    By: Thelonius Beck

Latest Styles

  • [vB 3.8.4] CompletevB - Skylight
    By: DreadKnight
  • [vB 3.8.3] [vB 3.8.4] Barcelona...
    By: hoiquantinhoc.com
  • [vB 3.8.3] Natures Walk by vBSkin...
    By: Chri5
  • [vB 3.8.3] Green Theme
    By: Robdog
  • [vB 3.8.2] Unreal T 3 - vB3.8.x
    By: Butcher

Latest Graphics

  • [vB ] [anim.]Team Ranks
    By: cRs!MP
  • [vB ] Abstract Circles (3...
    By: cRs!MP
  • [vB ] PlayStation Rank Images
    By: cRs!MP
  • [vB 3.6.12] Heavy Stroked Button...
    By: Shelley
  • [vB ] Minature Ranks.
    By: Shelley
vBulletin Modifications » General vBulletin Section » vBulletin Modification Tutorials » [How To] Make a basic cron job
Reply
Page 1 of 2 1 2 >

 

  • Thread Tools
Old 06-18-2006, 06:07 PM   #1
Nick R
vBulletin Guru

Nick R's Avatar

Activity Longevity
0/20 13/20
Today Posts
0/3 sssss4450
Location: Cyberspace, UK
Age: 30
Nick R is on a distinguished road
Send a message via MSN to Nick R Send a message via Yahoo to Nick R
Status: Offline Default [How To] Make a basic cron job
Ok, i will update this later but alot of people have been asking for this so i might as well make it.

Items needed:

vBulletin 3.5.x or vBulletin 3.6

Skills needed:

Know what query you want to run.

Ok here goes nothing:

1.) open up a text editor eg. ultra edit 32 or notepad
2.) Save the file with a name and .php at the end (NOT .txt)
3.) Add this to the start of the file:
PHP Code:
<?php
/*======================================================================*\
|| #################################################################### ||
|| # Name of Cron by Author                                ||
|| #################################################################### ||
\*======================================================================*/

// ---------------------------------------------------
// Start Set PHP Environment
// ---------------------------------------------------

error_reporting(E_ALL & ~E_NOTICE);
if (!
is_object($vbulletin->db))
{
    exit;
}

// ---------------------------------------------------
// Start Cronjob
// ---------------------------------------------------
4.) Then you can put what query you want to run. eg. to clear the strikes table you would put:
PHP Code:
global $vbulletin;
$vbulletin->db->query("delete from " . TABLE_PREFIX . "strikes"); 
5.) Then Log your action:
PHP Code:
log_cron_action('What you want to be in the log file eg. The strikes table has been cleared.', $nextitem); 
6.) Then finish off the script:
PHP Code:
// ---------------------------------------------------
// End Cronjob
// ---------------------------------------------------

?> 
7.) Then save your file and upload.
8.) Go into admincp and add a scheduled task with your file as the path.

Voila your done. A full example for clearing the strikes table is:
PHP Code:
<?php
/*======================================================================*\
|| #################################################################### ||
|| # Strikes prune cron Created By Nick                                                ||
|| #################################################################### ||
\*======================================================================*/

// ---------------------------------------------------
// Start Set PHP Environment
// ---------------------------------------------------

error_reporting(E_ALL & ~E_NOTICE);
if (!
is_object($vbulletin->db))
{
    exit;
}

// ---------------------------------------------------
// Start Cronjob
// ---------------------------------------------------

global $vbulletin;
$vbulletin->db->query("delete from " . TABLE_PREFIX . "strikes");

log_cron_action('Strikes pruned', $nextitem);

// ---------------------------------------------------
// End Cronjob
// ---------------------------------------------------

?>
vB Nova - Great vBulletin Help, Mods & Skins | PicoSphere - Free Image Hosting with No Pop-Ups
---------

Last edited by Nick R; 06-19-2006 at 04:00 PM.
Reply With Quote
Old 06-18-2006, 07:53 PM   #2
Norman
Coder

Norman's Avatar

Activity Longevity
0/20 13/20
Today Posts
0/3 ssssss242
Location: [Italy]
Norman is on a distinguished road
Send a message via MSN to Norman
Status: Offline Default
Man I love you! Really really thanks!!

Now I try it!
Reply With Quote
Old 06-18-2006, 07:53 PM   #3
Nick R
vBulletin Guru

Nick R's Avatar

Activity Longevity
0/20 13/20
Today Posts
0/3 sssss4450
Location: Cyberspace, UK
Age: 30
Nick R is on a distinguished road
Send a message via MSN to Nick R Send a message via Yahoo to Nick R
Status: Offline Default
oh and yeah and feel free to add. i did it in a rush.
Reply With Quote
Old 06-18-2006, 09:00 PM   #4
Reeve of Shinra
Coder

Activity Longevity
0/20 20/20
Today Posts
0/3 sssssss85
Reeve of Shinra is on a distinguished road
Status: Offline Default
This is great! Thank you

*bookmarks*
Reply With Quote
Old 06-19-2006, 04:25 PM   #5
Nick R
vBulletin Guru

Nick R's Avatar

Activity Longevity
0/20 13/20
Today Posts
0/3 sssss4450
Location: Cyberspace, UK
Age: 30
Nick R is on a distinguished road
Send a message via MSN to Nick R Send a message via Yahoo to Nick R
Status: Offline Default
no problem :D
Reply With Quote
Old 06-19-2006, 04:45 PM   #6
Butcher
Administrator
Butcher's Avatar

Activity Longevity
1/20 18/20
Today Posts
0/3 sssss1070
Location: lake district, england
Age: 30
Butcher is on a distinguished road
Status: Offline Default
really nice tut m8
many will find this helpful i'm sure me included
The Red Lion - Your online pub
Reply With Quote
Old 07-25-2006, 02:25 AM   #7
The Ottoman
vB Newbie

Activity Longevity
0/20 13/20
Today Posts
0/3 ssssssss1
The Ottoman is on a distinguished road
Status: Offline Default
Spot on dude.... Thanks.
Reply With Quote
Old 07-25-2006, 06:38 AM   #8
Nick R
vBulletin Guru

Nick R's Avatar

Activity Longevity
0/20 13/20
Today Posts
0/3 sssss4450
Location: Cyberspace, UK
Age: 30
Nick R is on a distinguished road
Send a message via MSN to Nick R Send a message via Yahoo to Nick R
Status: Offline Default
no probs :p
Reply With Quote
Old 10-14-2006, 05:47 PM   #9
marksyzm
vB Newbie

Activity Longevity
0/20 13/20
Today Posts
0/3 sssssss37
marksyzm is on a distinguished road
Status: Offline Default
Perfect, thanks
Reply With Quote
Old 10-14-2006, 07:48 PM   #10
G_man
Coder

G_man's Avatar

Activity Longevity
0/20 14/20
Today Posts
0/3 ssssss314
G_man is on a distinguished road
Status: Offline Default
Never got around to thanking you, so will do it now.

This is one of most useful Tut's I've seen. Cheers.
Reply With Quote

Reply
Page 1 of 2 1 2 >

« [How To] Create forum counters | Adding vb editor to a form »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Show Printable Version Show Printable Version
Email this Page Email this Page

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
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Rules

Similar Threads
Thread Thread Starter Forum Replies Last Post
[How To] Run vBulletin On your P.C. Ken Iovino vBulletin Modification Tutorials 83 11-02-2009 05:16 AM
[How To] Add Options per forum Ken Iovino vBulletin Modification Tutorials 10 03-03-2007 06:25 PM
[How To] Run a vb page outside of the forum directory Junior vBulletin Modification Tutorials 7 01-10-2007 10:05 PM
[How to] For new members Rex Growing Your vB Forum 4 05-26-2006 05:46 PM



All times are GMT. The time now is 10:06 PM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Transverse Styles
  • Top
  • Archive
  • vBSEO
  • Contact Us
LinkBack
LinkBack URL LinkBack URL
About LinkBacks About LinkBacks
Bookmark & Share
Digg this Thread! Digg this Thread!
Add Thread to del.icio.us Add Thread to del.icio.us
Bookmark in Technorati Bookmark in Technorati
Furl this Thread! Furl this Thread!