Whether you are using Linux on the desktop or as a server, it's still good that you're using Linux. Linux related questions go here.
Moderator: General Moderators
itsmani1
Forum Regular
Posts: 791 Joined: Mon Sep 29, 2003 2:26 am
Location: Islamabad Pakistan
Contact:
Post
by itsmani1 » Thu Mar 22, 2007 3:20 am
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,
Buddha443556
Forum Regular
Posts: 873 Joined: Fri Mar 19, 2004 1:51 pm
Post
by Buddha443556 » Thu Mar 22, 2007 7:26 am
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
blackbeard
Forum Contributor
Posts: 123 Joined: Thu Aug 03, 2006 6:20 pm
Post
by blackbeard » Thu Mar 22, 2007 12:14 pm
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.
itsmani1
Forum Regular
Posts: 791 Joined: Mon Sep 29, 2003 2:26 am
Location: Islamabad Pakistan
Contact:
Post
by itsmani1 » Wed Mar 28, 2007 10:00 am
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.
timvw
DevNet Master
Posts: 4897 Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium
Post
by timvw » Thu Mar 29, 2007 2:08 pm
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
)