Jump to content

Using wget and cron


sKunKbad

Recommended Posts

Didn't know where to ask this, so thought I ask here.

 

My cron works:

 

0 * * * * wget "http://mysite.com/test-cron.php"

 

but I get an email from the server that makes it sound like I'm not doing something right:

 

Resolving mysite.com... 123.45.678.90

Connecting to mysite.com|123.45.678.90|:80... connected.

HTTP request sent, awaiting response... 200 OK

Length: 0 [text/html]

test-cron.php: Permission denied

 

Cannot write to `test-cron.php' (Permission denied).

 

I know I can turn off the email by using  >/dev/null 2>&1, but I'm just wondering if I did something wrong, and that's why it says it can't write to the file, and permission denied. I don't care about writing to the file, I just want to run the php so it sends me an email. Also, I'm using wget because the file must be accessed via http for it to work.

Link to comment
Share on other sites

permissions? try making the file chmod to 0777

 

But I don't want to write to the file, only read, which it seems to be doing, because the script on it does run. I tried looking at wget config options to see if I could figure it out, but haven't done any testing yet because I haven't had time.

Link to comment
Share on other sites

You need to ensure that the server allows the execution of wget. A lot of servers by default have the ability to run this command disabled . Ensure it's configured correctly. It looks like it's not the file that's having a permission issue, it looks like the servers denying the wget command itself

Link to comment
Share on other sites

If it's on the same server, just run it directly though:

0 * * * * php /path/to/test-cron.php

 

The problem with that is that it's not an independent script. It's actually a controller/method in a CodeIgniter installation, and can't be accessed directly.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.