Cron Jobs


#1

For my site i wanted to setup a Cron Job for a file tick.php

I used telnet and setup a cronjob

0 * * * * /home/ek5932/tick.php

But It just keeps failing and i get the email:

/bin/sh: /home/ek5932/tick.php: Permission denied

Any help would be great, thanks.


#2

It’s telling you that the file “tick.php” is not executable.

The easiest solution would be to change the command to:

/usr/local/bin/php -f ~/tick.php

Another solution is to make the php file itself executable:

  1. ensure that the first line of the tick.php file is:
    #!/usr/local/bin/php -f
  2. chmod u+x ~/tick.php

#3

I agree with Mark, you may also make the file executable by changing the file properties in using your FTP program or IE.

CHMOD it to 777, or select all of the checkboxes in the popup menu.


#4

Well, you’d want 700 rather than 777, as giving write permissions to everybody is a little bit of a security risk. (You don’t want other people on your server to be able to modify the script.) In an FTP program, you’d leave the “write” box under “other” unchecked.