FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Cron jobs - running a php file





Stubru Freak
I never used a cron job before, so I have no idea how to do this... How can I run a php file named "cronjobs.php" located in a "/includes/" folder?

The folder is set to "deny from all" in .htaccess, so it can only be used as an include. Is that a problem? Can't cron jobs run it then?

This is the full directory of the file (I think):
/home/stubrufr/domains/battleschool.frih.net/public_html/includes/cronjobs.php

Could someone give me the complete text to fill in in the Command field please? I don't understand it at all.

Thank you very much,
Frederik Vanderstraeten
ml
Quote:
The folder is set to "deny from all" in .htaccess, so it can only be used as an include. Is that a problem? Can't cron jobs run it then?


no, thats no problem

Quote:

Could someone give me the complete text to fill in in the Command field please? I don't understand it at all.


Code:
php /home/stubrufr/domains/battleschool.frih.net/public_html/includes/cronjobs.php


hope it works Very Happy
Stubru Freak
No it doesn't Confused Don't know what I'm doing wrong Confused Tested the file manually and it works
JustaMin
This should work:

Code:
wget -q --http-user 'YOURUSERNAME' --http-passwd 'YOURPASSWORD' http://www.yoururl.com/yourscript.php


Replace with your username and password (as defined in your .htpasswd) and obviously the URL to your script.

Edit: just occured to me you don't mean the script is in a protected directory, in which case, this will be fine:

Code:

wget -q http://www.yoururl.com/yourscript.php
Stubru Freak
JustaMin wrote:
This should work:

Code:
wget -q --http-user 'YOURUSERNAME' --http-passwd 'YOURPASSWORD' http://www.yoururl.com/yourscript.php


Replace with your username and password (as defined in your .htpasswd) and obviously the URL to your script.

Edit: just occured to me you don't mean the script is in a protected directory, in which case, this will be fine:

Code:

wget -q http://www.yoururl.com/yourscript.php


Thanks man, it works
thnn
Change is to

Code:
php -q /home/stubrufr/domains/battleschool.frih.net/public_html/includes/cronjobs.php


That will pass it to the php parser and then let it run. Works better than using WGet which saves the file to the server.
charliehk
You could refer to the following post for cron job:
http://frihost.com/forums/vt-18622.html

btw, what is the option of "php -q"?
thnn
it passes the script to php.

I read it online a while ago.

EDIT: Sorry I made an error. You dont need the -q.
Stubru Freak
thnn wrote:
it passes the script to php.

I read it online a while ago.

EDIT: Sorry I made an error. You dont need the -q.


It doesn't work...
Related topics
Cron Jobs and Php
Cron Jobs
[PHP] Running Cron Jobs Via PHP Script
Executing automated tasks without using cron jobs
cron jobs?
Problems With Cron Jobs
Enabling Cron Jobs
how do I auto backup using cron jobs
Question: PHP scripting + cron jobs
how do cron jobs work?
Cron jobs on DirectAdmin
Cron jobs and PHP?
cron jobs running early
Has anyone installed Moodle successfully?
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.