Cron Jobs Access Denied

For discussions about game development that does not fit in any of the other topics.
Post Reply
User avatar
vitinho444
Posts: 2819
Joined: Mon Mar 21, 2011 4:54 pm

Cron Jobs Access Denied

Post 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)
My Company Website: http://www.oryzhon.com

Skype: vpegas1234
User avatar
fang
Posts: 31
Joined: Sat Feb 04, 2012 3:17 am

Re: Cron Jobs Access Denied

Post 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.
Python/PHP/Javascipt . HTML/CSS . MySQL/CouchDB . Apache/Nodejs . git/sh/ssh . Windows/MacOSX/Linux
User avatar
vitinho444
Posts: 2819
Joined: Mon Mar 21, 2011 4:54 pm

Re: Cron Jobs Access Denied

Post 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
My Company Website: http://www.oryzhon.com

Skype: vpegas1234
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: Cron Jobs Access Denied

Post 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);
?>
Post Reply

Return to “General Development”