CRONs not working what ever I do

Status
Not open for further replies.

bobycv

New Member
Messages
22
Reaction score
3
Points
0
Dear Sir,
I have tried searching for Cron on x10 forum and found the following statements which never worked.
/usr/bin/php /home/bobycv/public_html/cron/Test.php

php -q /home/bobycv/public_html/cron/Test.php

php-cron /home/bobycv/public_html/cron/Test.php

wget -O /dev/null /home/bobycv/public_html/cron/Test.php

while the Test.php contains the following code

<?php
echo "This is a test";
?>

I did not get any email from the cron job and also that another php file from a joomla plugin also did not work.
Please help me sir.My website requires auto backup and this requires cron to work.
I am on stoli server.
Please suggest

Regards,
Boby
 

lemon-tree

x10 Minion
Community Support
Messages
1,420
Reaction score
46
Points
48
As far as I can tell, email responses from Cron jobs is currently not active, meaning your cron may be running but you may not be notified. I haven't had an email about my crons since March, yet they are still dutifully running and keeping things updated. If you really need email notification, you could add a mail funciton to the PHP with mail().
The code you should be using is the first one:
/usr/bin/php /home/bobycv/public_html/cron/Test.php
Other variations may work, but that is how I have mine setup.
 
Last edited:

chauthai

New Member
Messages
7
Reaction score
0
Points
0
As far as I can tell, email responses from Cron jobs is currently not active, meaning your cron may be running but you may not be notified. I haven't had an email about my crons since March, yet they are still dutifully running and keeping things updated. If you really need email notification, you could add a mail funciton to the PHP with mail().
The code you should be using is the first one:

Other variations may work, but that is how I have mine setup.
I login to my database but is expected to be operational for help
 

bobycv

New Member
Messages
22
Reaction score
3
Points
0
I have just done a testing on cron jobs with a php file and if it works,then there should be a new article created in my joomla site.
But nothing such happend and hence I think that the cron has not worked.
Do you have any example code to test if cron is working on stoli server?
Please help.

regards,
boby
 
Last edited:

lemon-tree

x10 Minion
Community Support
Messages
1,420
Reaction score
46
Points
48
How often are you setting the Cron jobs to go off at? Remember that the times you put in will be relative to the server time, not necessarily your local time. i.e. I have to put in a time of 19:00 for it to go off at midnight GMT.
 

dlukin

New Member
Messages
427
Reaction score
25
Points
0
1. My friend tells me that Staff have said that email notifications have been turned off because it was putting a load on the mail server. 5 min cron job == 288 emails a day. Multiply by X accounts.

2. For PHP cron job, I use:

Code:
/usr/bin/php   /home/USER/public_html/SCRIPT.php  >>/home/USER/public_html/cronlog.txt  2>&1

This logs any output from the SCRIPT and more importantly also logs any errors, ie SCRIPT.php does not exist, the /usr/bin/php is the wrong path, etc.
All you need is add line like

echo date("F j, Y, g:i a") , "\n" ;

to keep a log of the cron running

3. If you want to have your script send an email notification,


Code:
$headers = 'From: name@yadda.x10hosting.com' . "\r\n" .
    'Reply-To: name@yadda.x10hosting.com' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

# name@yadda.x10hosting should be a real account on your domain
# so the x10 mailservers won't filter it out as possible 'spoof' or 'spam'

$sent = mail(  'toAddress@gmail.com', 'Subject of this email is',  'The message is', $headers ) ; 

if( sent ){
    echo "Sent email\n";
} else {
    echo "Problem sending email\n";
}
 
Last edited:

bobycv

New Member
Messages
22
Reaction score
3
Points
0
1. My friend tells me that Staff have said that email notifications have been turned off because it was putting a load on the mail server. 5 min cron job == 288 emails a day. Multiply by X accounts.

2. For PHP cron job, I use:

Code:
/usr/bin/php   /home/USER/public_html/SCRIPT.php  >>/home/USER/public_html/cronlog.txt  2>&1

This logs any output from the SCRIPT and more importantly also logs any errors, ie SCRIPT.php does not exist, the /usr/bin/php is the wrong path, etc.
All you need is add line like

echo date("F j, Y, g:i a") , "\n" ;

to keep a log of the cron running

3. If you want to have your script send an email notification,


Code:
$headers = 'From: name@yadda.x10hosting.com' . "\r\n" .
    'Reply-To: name@yadda.x10hosting.com' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

# name@yadda.x10hosting should be a real account on your domain
# so the x10 mailservers won't filter it out as possible 'spoof' or 'spam'

$sent = mail(  'toAddress@gmail.com', 'Subject of this email is',  'The message is', $headers ) ; 

if( sent ){
    echo "Sent email\n";
} else {
    echo "Problem sending email\n";
}

After Following the above ,
1.I could use cron to send email--Thanks to dlukin for that.I put a reputation for you.
2.But for using a php file,the following is written to the log file
Status: 404 Not Found

X-Powered-By: PHP/5.2.13

Content-type: text/html



No input file specified.
Status: 404 Not Found

X-Powered-By: PHP/5.2.13

Content-type: text/html



No input file specified.
Status: 404 Not Found

X-Powered-By: PHP/5.2.13

Content-type: text/html



No input file specified.



Can you help me with this too..
Regards,
Boby
 
Last edited:

dlukin

New Member
Messages
427
Reaction score
25
Points
0
2.But for using a php file,the following is written to the log file
Status: 404 Not Found

X-Powered-By: PHP/5.2.13

Content-type: text/html



No input file specified.
Status: 404 Not Found


Can you help me with this too..
Regards,

Can you paste the cron job line here (hide your cPanel username in the file paths...)?
 

bobycv

New Member
Messages
22
Reaction score
3
Points
0
The corn command i used is put below

/usr/bin/php /home/bobycv/public_html/bumpit/components/com_rss2content/cron/www.cbv.exofire.net26062010142015000000.php >>/home/bobycv/public_html/bumpit/cronlog.txt 2>&1

Please help.
Thank You.
 

dlukin

New Member
Messages
427
Reaction score
25
Points
0
/home/bobycv/public_html/bumpit/components/com_rss2content/cron/www.cbv.exofire.net26062010142015000000.php

drop the www. from the path.
 
Status
Not open for further replies.
Top