Author Topic: Strange result from cron job  (Read 650 times)

utah

  • Active Member
  • **
  • Posts: 38
  • Karma: +1/-0
Strange result from cron job
« on: August 04, 2011, 08:38:18 PM »
I'm receiving a strange result from the cron job, which I set up in my hosting account:

The email says only this:

Content-type: text/html

So, I wonder... is something wrong ? how is the email from the cron job supposed to look like ?
I don't have a shell access in my hosting account so I really don't know whats going on with the cron jobs...

So far I set it up to run only once a hour, until I see the result... then later on I will change it to run every 5 minutes.
Here is the command that I use: /web/cgi-bin/php5 /home/content/myuserid/html/tools/cron/cron.php


Thanks


Utah

maverick

  • Active Member
  • **
  • Posts: 1382
  • Karma: +93/-1
    • Etano Templates
Re: Strange result from cron job
« Reply #1 on: August 04, 2011, 09:16:45 PM »
Quote
Content-type: text/html
When this shows usually there's some html based info that follows describing some errors

Only you will know what the correct path is on your server, all I can tell you is if the end part of the command is correct or not.

This is typcially how it will be on most servers, the part in blue is all I can tell you is right or not
/usr/bin/php -f /home/your_user/public_html/tools/cron/cron.php
what the correct path should be before that you will need to find out yourself, or ask your host what it should be.
 
Etano Templates and Mods

http://www.maverickwebworks.com

utah

  • Active Member
  • **
  • Posts: 38
  • Karma: +1/-0
Re: Strange result from cron job
« Reply #2 on: August 06, 2011, 01:18:13 AM »
I contacted my hosting provider and got this reply:

Thank you for contacting Online Support.  Based on the information provided, you have a concern with your cron job for your hosting account.  We have tested the cron job system and it is functioning properly at this time.  We have included a test file in the root of your server to verify this test.  This file is called "cron_test.txt".  We have reviewed your account and could not find any issues with the hosting account. The type of error you are experiencing is most likely caused by coding or scripting. Because we do not provide coding support, we are unable to determine what specifically in your code may be causing the error.

You may wish to review your code to determine if there are any issues, because it appears that is the most likely cause of the error. You may also wish to enable detailed error messages as a temporary diagnostic measure. The procedure for this will vary, depending on the scripting language being used. We also recommend consulting both the vendor's online documentation, as well as the large number of online forums dedicated to coding and scripting.



My path is also correct, so I really don't know what is the problem....


Utah

maverick

  • Active Member
  • **
  • Posts: 1382
  • Karma: +93/-1
    • Etano Templates
Re: Strange result from cron job
« Reply #3 on: August 06, 2011, 03:30:07 AM »

Well you didn't say exactly what problems you're having, other than the supposedly strange report you got which may mean nothing is wrong.

There's nothing wrong with the script or the coding, I've been running Etano sites for more than 4 years with hardly a hiccup, as have many other users.

Are you experiencing issues on the site such a new users not showing up in widgets or search results, new blogs not showing up, email notifications not being sent, etc? These are signs your crons aren't functioning properly, possibly your host has restrictions on crons running under 15 minutes, especially every 5 minutes.

Does your host support the following recommended requirements for Etano:

*PHP 5.x - as an Apache module, NOT in CGI/FastCGI

*Preferably with mod_suPHP "disabled" to prevent potential permission issues

*MySQL 5.x

*Ability to run cron jobs every 5 minutes

*GD 2.x  Library for the dynamic creation of images

* FreeType support enabled for captcha

*Supports uploading and editing of .htaccess files

Etano Templates and Mods

http://www.maverickwebworks.com

utah

  • Active Member
  • **
  • Posts: 38
  • Karma: +1/-0
Re: Strange result from cron job
« Reply #4 on: August 06, 2011, 03:37:47 AM »
Hello, I really don't know what the problem is or if there is a problem, I only know that I get this message in my email:

Content-type: text/html

If this message indicates a problem or not I don't know, because I don't have any experience with cron jobs from etano, but maybe some other members here knows how a cron email report should look like ?

By the way I am considering changing my hosting provider, do you recommend any one ?

Thanks :)

Utah


maverick

  • Active Member
  • **
  • Posts: 1382
  • Karma: +93/-1
    • Etano Templates
Re: Strange result from cron job
« Reply #5 on: August 06, 2011, 03:52:56 AM »
I can't personally recommend any shared hosting because I've had my own dedicated server for almost 10 years. However, in the past some users have recommended http://hostforweb.com they seem to support all kinds of dating and SN scripts.

Just be sure check with them (or any other host) to see if they support the following requirements for Etano:

*PHP 5.x - as an Apache module, NOT in CGI/FastCGI

*Preferably with mod_suPHP "disabled" to prevent potential permission issues

*MySQL 5.x

*Ability to run cron jobs every 5 minutes

*GD 2.x  Library for the dynamic creation of images

* FreeType support enabled for captcha

*Supports uploading and editing of .htaccess files
Etano Templates and Mods

http://www.maverickwebworks.com

utah

  • Active Member
  • **
  • Posts: 38
  • Karma: +1/-0
Re: Strange result from cron job
« Reply #6 on: August 06, 2011, 02:30:44 PM »
Hi

I opened a support ticket 3 times at my hosting providers website, asking the same question over and over again; what is the correct path to the php executable, but they just came up with the same b***s*** answer every time, so I finally gave up the support service. It's obvious that they don't want to give me the path to php.

However, from my phpinfo script I noticed the following: './configure' '--enable-fastcgi' '--prefix=/usr/local/php5' '
So, I assumed that the correct path to the php executable could be: /usr/local/php5/bin/
In my hosting provider's FAQ they said that correct path is: /web/cgi-bin/php5

In other words; totally wrong information and secrecy from my hosting provider.

Anyway, I don't get any cron output messages in my email anymore, so I assume that the cron jobs are running just fine. At least, everything seems to be working fine now in my dating site.

My cron jobs are running at these intervals: (minutes past every hour)

00
05
10
15
20
25
30
35
40
45

There are no cron jobs running at 50 and 55 because my hosting provider only allows 10 cron jobs. Could this be a problem for my dating site ?


Utah   

maverick

  • Active Member
  • **
  • Posts: 1382
  • Karma: +93/-1
    • Etano Templates
Re: Strange result from cron job
« Reply #7 on: August 06, 2011, 04:09:56 PM »
You only need to create ONE cron job with settings of  */5 * * * *

Read the installation instructions under Adding a new cron job in cPanel carefully .... http://www.datemill.com/etano/wiki/doku.php?id=installation
Etano Templates and Mods

http://www.maverickwebworks.com

utah

  • Active Member
  • **
  • Posts: 38
  • Karma: +1/-0
Re: Strange result from cron job
« Reply #8 on: August 07, 2011, 01:16:17 AM »
Yes I actually thought about that but I had doubts it would work because in my cron manager there are some predefined time intervals, as you can see in the attached picture. That was the reason I created one job for each of the time intervals. (except x:50 and x:55 as explained in my previous post)



So, I dont know what will happen if I let's say choose x:00 from the "Minute" dropdown list and then add
*/5 * * * * at the beginning of the command ?

Do you think it will still work ?


Utah


ripcord

  • Member2
  • **
  • Posts: 15
  • Karma: +3/-0
    • Designed by Roger
Re: Strange result from cron job
« Reply #9 on: August 07, 2011, 04:10:38 AM »
As the installation instructions and Maverick describe, "*/5 * * * ** forms the frequency component of a line added to the crontab (cron table) file and therefore cannot be prepended to your current command. You will just get error messages all over the place.

Read the installation instructions again.

Check you are using the correct path to the cron file (the path you were given at the end of the installation process).

Check for any error messages in Etano Admin.

It seems you have two concerns.

1. Is cron running properly
2. how can I set the frequency.

Answer to 1. is that you can check three ways. First way, ask your host cron process to return an email to you on completion. check the mail for error messages. Second way, create a newsletter from Etano admin; get your "test" user to upload an image and create a blog entry then wait until your cron has executed. The uploaded image should now be visible to other users, as well as the new blog entry, additionally, the "test" user should get the newsletter email. The third way is using the "browser" version of the supplied cron file (cron_web.php NOT cron.php) together with the licence key.

Find the license key in the file includes/defines.inc.php. and paste this together with the path into your browser address field:

http://www.your_site.com/tools/cron/cron_web.php?lk=XXXXXXXXXXXXXXXX

If it's working properly, you should see a result something like this:

time: 9:25
clean_online_table: 0 seconds
send_queue_message: 0 seconds
get_osignal_feed: 0 seconds
send_queue_mail: 0 seconds
clear_search_cache: 0 seconds
save_dot_stats5: 0 seconds
6 jobs run.


I would use all of these methods to be sure.

Answer to 2. Looking at your host screen, it seems you have set the frequency at least the best you can. But you don't need ten cron jobs, just one job running each 5 minutes, if you have no choice, then set one job each five minutes and between the last one and the first will be ten minutes, I don't think it will make too much of a difference, it depends on the activity on your site.

If you're not happy with this, try an external cron host.  I just searched and found http://webbasedcron.com. It costs $25/year and you can have up to 5 jobs running as often as one minute frequency. There are others, costing more or less, some free, you choose.

Cheers!
« Last Edit: August 07, 2011, 12:57:36 PM by ripcord »

utah

  • Active Member
  • **
  • Posts: 38
  • Karma: +1/-0
Re: Strange result from cron job
« Reply #10 on: August 07, 2011, 04:42:09 AM »
Wow, great reply! Thanks a lot :)

I will look into these issues.


Utah

maverick

  • Active Member
  • **
  • Posts: 1382
  • Karma: +93/-1
    • Etano Templates
Re: Strange result from cron job
« Reply #11 on: August 07, 2011, 04:54:30 AM »
As far as minutes go, only every 5 minutes is required,

This short hand
*/5 * * * *

Stands for this ...
 “Every Five Minutes”   “Every Hour” “Every Day”   “Every Month”   “Every Week Day”
Etano Templates and Mods

http://www.maverickwebworks.com

utah

  • Active Member
  • **
  • Posts: 38
  • Karma: +1/-0
Re: Strange result from cron job
« Reply #12 on: August 07, 2011, 11:14:42 PM »
I got it now, my cron jobs are running fine but once in a while I get this error message in my email:

error retrieving the feed-->

However it is not often, only now and then...

Utah

maverick

  • Active Member
  • **
  • Posts: 1382
  • Karma: +93/-1
    • Etano Templates
Re: Strange result from cron job
« Reply #13 on: August 08, 2011, 12:04:13 AM »
Don't worry about the feed error, that's likely the feed in the Admin for notices and updates that comes from datemill and it may only be active if there happens to be any notices.
Etano Templates and Mods

http://www.maverickwebworks.com

utah

  • Active Member
  • **
  • Posts: 38
  • Karma: +1/-0
Re: Strange result from cron job
« Reply #14 on: August 08, 2011, 09:01:38 AM »
Here we go again...now I changed my hosting provider from godaddy to hostforweb.

My cronjob doesn't seem to do anything, because I can still not search other members and the new blog entries are not visible for other users.

The command "which php" gives me this output: /usr/local/bin/php
Based on that info I created a cron job.
"crontab -l" gives me this output: 5 * * * * /usr/local/bin/php -f /home/xxxxxxxx/public_html/tools/cron/cron.php

(xxxxxxxx = my username) Hidden for security reasons

When I run cron from the web browser it looks like it's working fine:

http://www.mydomain.com/tools/cron/cron_web.php?lk=EWERASEGAWEWUBAPEZEKUM

time: 14:45
save_dot_stats5: 0 seconds
send_queue_message: 0 seconds
clean_online_table: 0 seconds
send_queue_mail: 0 seconds
clear_search_cache: 0 seconds
get_osignal_feed: 0 seconds
6 jobs run.

However, even the cron output looks ok, it doesn't say anything about updating blog messages, and the search function still doesn't return any members and the blog entries are not showing up...

Any advices are appreciated :)
Thanks!

Utah