Jump to content

CRON jobs - Using Plesk 8x Tried wget, curl... No results and 500 ERROR


BizLab

Recommended Posts

So i've been kicking around with this cron job for a few days, and i am recieving error after error. I would prefer to run the job without the use of a browser type program, so that i can block access to the php script from the web. I am currently running a simple phpmailer script every 2 minutes for testing purposes, and i am getting a server 500 error. there is nothing in the code that could be failing, so i was looking for some input.

 

USING

- Apache 2.0 handler

- CentOS

- Plesk 8x

- VPS server

 

My current command is:

2 * * * * wget https://www.domain.com/admin/office/cron-jobs/test-2.php

 

I have also tried:

2 * * * * curl https://www.domain.com/admin/office/cron-jobs/test-2.php

 

And even:

2 * * * * /var/bin/php /var/www/vhosts/domain.com/httpdocs/admin/office/cron-jobs/test-2.php

 

The last was an attempt to avoid the browser systems all together.

 

The result of the cURL was the most profitable showing (cron log email):

-----------------------------------------------------------------

  % Total    % Received % Xferd  Average Speed  Time    Time    Time  Current

                                Dload  Upload  Total  Spent    Left  Speed

 

100  337  100  337    0    0  1040      0 --:--:-- --:--:-- --:--:--  1040

100  337  100  337    0    0  1040      0 --:--:-- --:--:-- --:--:--    0

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head>

<title>302 Found</title>

</head><body>

<h1>Found</h1>

<p>The document has moved <a href="https://www.domain.com/admin/office/cron-jobs/test-2.php

<address>Apache/2.2.3 (CentOS) Server at www.domain.com Port 80</address> </body></html>

------------------------------------------------------------------

 

the wget resulted in this error

-------------------------------------------------------------------------

--10:10:01--  https://www.domain.com/admin/office/cron-jobs/ad-expired-notice.php

Resolving www.domain.com... Connecting to www.domain.com|ipaddress|:443... connected.

HTTP request sent, awaiting response... 500 Internal Server Error

10:10:01 ERROR 500: Internal Server Error.

------------------------------------------------------------------------

 

And when tested in the browser manually, all the test scripts work 100%

 

 

The test Script

<?php
require('/phpmailer/class.phpmailer.php');
$msg = '<p>TEST EMAIL # 2 FROM CRON JOBS</p>';
$mail = new PHPMailer;
$mail->ClearAddresses();
$mail->AddAddress('email@domain.com', 'Dude'); 
$mail->From = 'email@domain.com';
$mail->FromName = 'Dudes email@domain.com';
$mail->Subject = '# 2 YOUR TEST!';
$mail->Body = $msg;
$mail->isHTML = true;
$mail->AltBody = text;
$mail->Send();	
?>

 

 

 

Any ideas guys??

Link to comment
Share on other sites

Good call Thorpe, i must have been dilerous while tuping that command!! only one more problem: the cron job only ran once... it is set for every 2 minutes and was activated for about 35 minutes - any thoughts?

Link to comment
Share on other sites

Thanks thorpe!! I just figured it out 5 minutes ago!! lol - i appreciate the help though  ;)

 

Everything seems to be running perfectly! I will try to block access to these scripts using .htaccess deny from all  - - or do you think i would be better served to use another method?? I have seen a $_SERVER[''] method somewhere, but i can't recall the exact syntax for this. The .htaccess method would stop the script from even attempting to run or performing any evaluations, so i figured it may be more efficient.

 

 

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.