Problem running cron job

Status
Not open for further replies.

dpyro200488

Member
Messages
36
Reaction score
1
Points
8
I'm trying to run a cron job but am getting 403 error:
HTML:
<!DOCTYPE html>
<html style="height:100%">
<head><title> 403 Forbidden
</title></head>
<body style="color: #444; margin:0;font: normal 14px/20px Arial, Helvetica, sans-serif; height:100%; background-color: #fff;">
<div style="height:auto; min-height:100%; ">     <div style="text-align: center; width:800px; margin-left: -400px; position:absolute; top: 30%; left:50%;">
        <h1 style="margin:0; font-size:150px; line-height:150px; font-weight:bold;">403</h1>
<h2 style="margin-top:20px;font-size: 30px;">Forbidden
</h2>
<p>Access to this resource on the server is denied!</p>
</div></div><div style="color:#f0f0f0; font-size:12px;margin:auto;padding:0px 30px 0px 30px;position:relative;clear:both;height:100px;margin-top:-101px;background-color:#474747;border-top: 1px solid rgba(0,0,0,0.15);box-shadow: 0 1px 0 rgba(255, 255, 255, 0.3) inset;">
<br>Proudly powered by  <a style="color:#fff;" href="http://www.litespeedtech.com/error-page">LiteSpeed Web Server</a><p>Please be advised that LiteSpeed Technologies Inc. is not a web hosting company and, as such, has no control over content found on this site.</p></div></body></html>

I tried a bunch of different methods but get the same result:
Code:
/usr/bin/curl --silent /home/[redacted]/index.php?update_feedwordpress=1 >> /home/[redacted]/logs/cronjob.txt 2>&1

Code:
/usr/bin/php /home/[redacted]/curl.php >> /home/[redacted]/logs/cronjob.txt 2>&1
PHP:
<?php
// create a new cURL resource
$ch = curl_init();

// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "http://somewebsite.com/?update_feedwordpress=1");
curl_setopt($ch, CURLOPT_HEADER, 0);

// grab URL and pass it to the browser
curl_exec($ch);

// close cURL resource, and free up system resources
curl_close($ch);
?>
 

descalzo

Grim Squeaker
Community Support
Messages
9,373
Reaction score
326
Points
83
1. What message did you get for the first code snippet? Hint: adding "--silent" is lousy for debugging.

2. I ran that command (minus --silent)on xo2 and got the error logged as "curl: (3) <url> malformed"

3. url ? Did you give it a url or a path? Maybe try giving it an actual url (including http://) instead of an internal path.

4. Looking into your second attempt.
 

dpyro200488

Member
Messages
36
Reaction score
1
Points
8
I've given both the full url and the relative path. Neither seems to work.
Also tried
Code:
wget -q --spider http://somewebsite.com?update_feedwordpress=1 >> /home/[redacted]/logs/cronjob.txt 2>&1
 

descalzo

Grim Squeaker
Community Support
Messages
9,373
Reaction score
326
Points
83
Does the link work if you just stick it into a browser? (also, check the spelling of the link)
 

leafypiggy

Manager of Pens and Office Supplies
Staff member
Messages
3,819
Reaction score
163
Points
63
I *think* this might be due to ModSecurity. Let me look into it.
 

dpyro200488

Member
Messages
36
Reaction score
1
Points
8
The wget command seems to work if i change the url to the x10.mx domain. Otherwise it gives me the 403 error.
 

descalzo

Grim Squeaker
Community Support
Messages
9,373
Reaction score
326
Points
83
Possibility (ie a wild guess):
x10.mx is served directly by x10hosting
.com goes through CloudFlare ... they detect it is an automated request and so disallow it. Not sure how to fix it if that is the case. You would have to check with CloudFlare.
 

descalzo

Grim Squeaker
Community Support
Messages
9,373
Reaction score
326
Points
83
How are you trying to "run the script locally"?
 

descalzo

Grim Squeaker
Community Support
Messages
9,373
Reaction score
326
Points
83
This?
Code:
/usr/bin/curl --silent /home/[redacted]/index.php?update_feedwordpress=1 >> /home/[redacted]/logs/cronjob.txt 2>&1
 
Status
Not open for further replies.
Top