Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Permission denied in cron jobs command [closed]

Tags:

php

apache

I'm adding a new cronjob using the command command:

/bin/sh: /home/gbtusyll/public_html/run.php

But the command doesn't run and i get a mail stating:

/bin/sh: /home/gbtusyll/public_html/run.php: Permission denied

What is the problem?

like image 834
Sachin Saini Avatar asked Feb 29 '12 11:02

Sachin Saini


People also ask

What is * * * * * In cron job?

What does * mean in Cron? The asterisk * is used as a wildcard in Cron. * sets the execution of a task to any minute, hour, day, weekday, or month.

How do I fix Permission denied in Linux terminal?

To fix the permission denied error in Linux, one needs to change the file permission of the script. Use the “chmod” (change mode) command for this purpose.

Do cron jobs run when terminal is closed?

Show activity on this post. When your computer is shut down (or the cron daemon is otherwise not running), cron jobs will not be started. If you have jobs that you would like to run after the fact during those times when the computer is shut down, use anacron.


2 Answers

Use php /home/gbtusyll/public_html/run.php instead to run it as a PHP script instead of a regular shell script.

like image 62
praseodym Avatar answered Oct 04 '22 10:10

praseodym


try

chmod +x run.php 

also ensure that proper owner is set (i.e. if you are logged as user, if the owner of the file is 'user' - you can do it for example by running ls -la

careful: this might be very dangerous on production evironment, however I believe this would solve your development problem. You should read more about permissions later on

like image 43
mkk Avatar answered Oct 04 '22 10:10

mkk