Page 1 of 1
Cron job question
Posted: Thu Mar 22, 2007 3:20 am
by itsmani1
here are two entries that I entered in my cron job file.
I want 1st to run every 30 minutes and 2nd every hour. Just wanted to check if its correct or not? if not please help me in this regard.
Code: Select all
2 * * * * /home/tchest/public_html/update0/test1.php
@hourly /home/tchest/public_html/sc.php
Its not working at the moment i waited many minutes but did not see any out of the job.
Thank you,
Posted: Thu Mar 22, 2007 7:26 am
by Buddha443556
Do the PHP files have shebangs (!#) pointing to PHP executable? If not you need to add PHP (cgi/command line) to those cron entries. Usually that's something like: /usr/bin/php
Code: Select all
2 * * * * /usr/bin/php /home/tchest/public_html/update0/test1.php
@hourly /usr/bin/php /home/tchest/public_html/sc.php
Re: Cron job question
Posted: Thu Mar 22, 2007 12:14 pm
by blackbeard
Code: Select all
*/30 * * * * /path/to/php /home/tchest/public_html/update0/test1.php
0 * * * * /path/to/php /home/tchest/public_html/sc.php
Replace /path/to/php with whatever the path to the php executable is.
Posted: Wed Mar 28, 2007 10:00 am
by itsmani1
How can i find "/path/to/php" ?
Does this means that it will run after every 59 minutes?
Code: Select all
*/59 * * * * php /home/tchest/public_html/update0/test1.php
One more thing i wanted to tell you is:
if i am in update0 dir and i run php test1.php on command line it works fine. and gives me output.
Posted: Thu Mar 29, 2007 2:08 pm
by timvw
itsmani1 wrote:How can i find "/path/to/php" ?
Run the following command: whereis php
itsmani1 wrote:
Does this means that it will run after every 59 minutes?
Code: Select all
*/59 * * * * php /home/tchest/public_html/update0/test1.php
Yes (but if i'm not mistaken it well e-mail all output.. which may be not desired

)