Page 1 of 1

Cron Jobs Access Denied

Posted: Tue Mar 06, 2012 2:14 pm
by vitinho444
Hey all :D

I recently found cron jobs, and how to do it :D
Well i got a script that should be runeed every 5 minutes so it doesn't "fu*k" the Server speed.

But i also have a mail command that should send a email every time the cron job is runned.
But in the email it says:
/bin/sh: /home/oryzhonc/public_html/Scripts/vw/resx.php: Permission denied

Here's the command:

Minute Hour Day Month Weekday Command
*/5 * * * * /home/oryzhonc/public_html/Scripts/vw/resx.php

Just for information: I got a deny access of the Scripts folder but i dont know how i did it :S
Here's the htaccess:

Code: Select all

RewriteEngine on
RewriteCond %{HTTP_HOST} ^oryzhon\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.oryzhon\.com$
RewriteRule ^/?$ "http\:\/\/www\.oryzhon\.com\/en" [R=301,L]



Options -Indexes 
Well, the main problem is that the script is not being executed :S (Its a resource's system, so it goes through the database and gives resources to the people that passed the 1 hour time)

Re: Cron Jobs Access Denied

Posted: Tue Mar 06, 2012 5:34 pm
by fang
That looks like a system-level permission error. The htaccess shouldn't affect this; it only adds rules to apache.

What permissions do you have set on the file/directory? What user is the cron running as? If cron doesn't have access to the directory, or if the file can't be read by cron, the script won't execute.

Also, you might have to explicitly invoke php and pass it the script path as an argument.

Re: Cron Jobs Access Denied

Posted: Tue Mar 06, 2012 8:05 pm
by vitinho444
well i followed the video 35 & 36 of halls tutorials about another way of crons and its working so thanks for the reply.

Sorry for lost time :S

Re: Cron Jobs Access Denied

Posted: Thu Mar 08, 2012 9:02 pm
by hallsofvallhalla
Send the mail through the PHP script instead.

Code: Select all

<?php
$to      = 'nobody@example.com';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: webmaster@example.com' . "\r\n" .
    'Reply-To: webmaster@example.com' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);
?>