Page 1 of 1
cron - permission denied
Posted: Tue Sep 27, 2005 1:06 am
by s.dot
I tried to set up my first cron job using this command
Code: Select all
0 2 * * * /home/scottttt/public_html/tasks.php
The results of this are:
/bin/sh: line 1: /home/scottttt/public_html/tasks.php: Permission denied
Why am I getting this message?
Posted: Tue Sep 27, 2005 1:08 am
by feyd
is the file executable? (I think that is what is needed...)

Posted: Tue Sep 27, 2005 3:40 am
by Chris Corbyn
Code: Select all
0 2 * * * "/usr/bin/php /home/scottttt/public_html/tasks.php"
or alternatively like feyd mentioned.... try this, it's interesting to know anyway:
add this line to the VERY top line of the PHP script:
That should not be in PHP tags that should be all that's on the line... it's a shebang line and tell the script which program run it
Then you need to make the script executable:
After that, your original crontab should work

Executing files requires the "x" permission to be set.
Note: The .php is not needed if you add the shebang to an executable script. Nice for making command line tools
Posted: Tue Sep 27, 2005 10:58 am
by timvw
a couple of sample entries
Code: Select all
*/30 * * * * cd /home/screwedup/web/tools; /usr/bin/php ringupdater.php > /dev/null 2>&1
5 1 * * * /usr/bin/wget http://www.example.com/tools/ringnotify.php | mail -s "ringnotify.php" me@example.com