PDA

View Full Version : Cron



Avalanche
03-09-2004, 08:26 PM
Hello.

I wish to run a cron script that executes a .php file, which will clear database logs. I have set up the script, but am not quite sure how to execute it with cron.

I've searched the forums, but am still confused. I do not know how to specify the URL path for the script. I think my domain is important, so that is avalanche.hell-yeah.net.

I have avalanche.hell-yeah.net/public_html/asn/scripts/clear_log.php

What exactly would I put as the URL for cron in order to execute that?

Thank you.

Also, how can I make sure only cron executes it and not a user viewing the page? CHMOD 700?

Avalanche
03-09-2004, 08:32 PM
After tinkering around, I think this does it:

/usr/local/bin/php /home/avalanche/public_html/asn/scripts/clear_log.php

Is this correct?

ProWebUK
03-10-2004, 07:29 AM
Originally posted by Avalanche
After tinkering around, I think this does it:

/usr/local/bin/php /home/avalanche/public_html/asn/scripts/clear_log.php

Is this correct?

Yes providing /usr/local/bin/php is the correct path to your php binary :)

You will also need to add, before that, the time settings cron needs to have.

Chris

Avalanche
03-10-2004, 09:38 AM
Okay, but I can simply use the input boxes for this, correct?

Also, I set the script to input a log into the database every hour at minute 5. This seems to be working, and my log has a record of everything from then until now, EXCEPT for 4 AM.

13 cron script 2004-03-09 23:05:05 ran test script
14 cron script 2004-03-10 0:05:04 ran test script
15 cron script 2004-03-10 1:05:05 ran test script
16 cron script 2004-03-10 2:05:14 ran test script
17 cron script 2004-03-10 3:05:06 ran test script
log should have been inserted here as well
18 cron script 2004-03-10 5:05:04 ran test script
19 cron script 2004-03-10 6:05:03 ran test script
20 cron script 2004-03-10 7:05:03 ran test script
21 cron script 2004-03-10 8:05:06 ran test script
22 cron script 2004-03-10 9:05:06 ran test script
23 cron script 2004-03-10 10:05:02 ran test script
24 cron script 2004-03-10 11:05:07 ran test script

Any idea why?

DirectAdmin Support
03-10-2004, 10:42 AM
Strange.. maybe the server was rebooting?

John