I've written a couple of cron jobs/Scheduled Tasks for my site. Here is the basic template I use:
Code:
<?php
// ######################## SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);
if (!is_object($vbulletin->db))
{
exit;
}
// ########################################################################
// ######################### START MAIN SCRIPT ############################
// ########################################################################
Queries and Stuff Here
$vbulletin->db->query("Your Query"
);
log_cron_action('', $nextitem, 1);
?>