PDA

View Full Version : Move 'Hourly Cleanup' Scheduled Tasks, to cpanel cronjob


basketmen
12-15-2011, 11:49 AM
Hi guys, i want to Move 'Hourly Cleanup' Scheduled Tasks, to cpanel cronjob, so cleaning more constant and stable from server side, not from if someone load the cron image in the footer template



i created cronjob in cpanel, but its looks like not working

the command is
php /home/username/public_html/includes/cron/cleanup.php



in the email notification, only get this
X-Powered-By: PHP/5.2.17
Content-type: text/html




i already tried moving the cleanup.php file to the root (/home/username/public_html/cleanup.php) , but its looks like still not working




please help how to Move that Scheduled Tasks, to cpanel cronjob, really need to do it

kh99
12-15-2011, 03:27 PM
I don't think you can call the cron/cleanup.php directly, it assumes that some things have been done already (like the database connection created, etc). I haven't tried it, but I think if I were doing that I would probably try making the cron command something like:

curl www.mydomain.com/cron.php


(assuming you have a linux server and the curl command is available, of course). Also of course you want to replace www.mydomain.com with the actual path to your forum.

Adrian Schneider
12-15-2011, 03:40 PM
In your cron files, try adding the following to the top:

error_reporting(E_ALL ^ E_NOTICE ^ 8192);

chdir('/path/to/vbulletin');
require('./global.php');

Be sure to either copy them elsewhere or disable the originals as this would otherwise break them.

kh99
12-15-2011, 04:05 PM
In your cron files, try adding the following to the top:


Cool, does that work? I've never tried running vb scripts from the command line. ETA: Seems like it does.

Adrian Schneider
12-15-2011, 04:15 PM
I haven't tried it with cron jobs, but I have a ton of development tools which I use all from the command line. As long as you include global.php then you're good to go.