Reputation: 53
What is wrong with this cronjob?
* * * * * * php -f /Documents/Programs/WeeklyHours/weekly_hour.php
I have combed through the various cron questions on StackExchange and nothing is working. When I run php -f /Documents/Programs/WeeklyHours/weekly_hour.php in the terminal it works perfectly. I know the cron jobs are running because I am getting error mail. At the bottom of the error mail messages it is saying "/bin/sh: Applications: command not found." Any ideas on what I am doing wrong?
Thanks in advance.
Upvotes: 0
Views: 1264
Reputation: 943
You have one more * than required in your crontab entry
Try
0-59 * * * * php -f /Documents/Programs/WeeklyHours/weekly_hour.php
The 0-59 is so that it will run every minute
Upvotes: 4
Reputation: 1
* * * * * * /usr/local/bin/php -f /Documents/Programs/WeeklyHours/weekly_hour.php >> /ww/xx.log 2>&1
You can view the log.
Upvotes: 0
Reputation: 522110
The cron job likely runs under a different user which does not have its PATH
set up the same as you, so it cannot find the php
executable. You are able to simply type php
because your PATH
variable is set up to include its parent directory; that is not necessarily true for all other users.
Explicitly specify the path to the executable, e.g. /usr/bin/php
. To figure out which php
you're using, type:
$ which php
Upvotes: 0