CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM (Moderator: Dave Greenberg) »
  • Cron Jobs! :-(
Pages: [1]

Author Topic: Cron Jobs! :-(  (Read 2166 times)

sailormatt

  • I post occasionally
  • **
  • Posts: 39
  • Karma: 1
  • Explore, Dream, Discover!
    • Morvargh Sailing Project
  • CiviCRM version: 4.3.3
  • CMS version: Joomla 2.5.11
  • MySQL version: 5.1.41
  • PHP version: 5.5.30
Cron Jobs! :-(
June 07, 2013, 07:55:25 am
Hi All

Wondered whether anyone could help with my Cron problem?

I am trying to get cron to run my scheduled jobs, I can run the following in my browser window and it fires the scheduled jobs with no problems.

Code: [Select]
http://[siteroot]/administrator/components/com_civicrm/civicrm/bin/cron.php?name=[myusername]&pass=[mypassword]&key=[mysitekey]
But when I run it with Cron (in Cpanel) with the code below I get nothing.

Code: [Select]
wget -O - -q -t 1 "http://[siteroot]/administrator/components/com_civicrm/civicrm/bin/cron.php?name=[myusername]&pass=[mypassword]&key=[mysitekey]"
I tried using just "wget" instead of the -O etc and this also didn't work; then added 'wget logcron.log' before the url and had the following returned in the log file which makes absolutely no sense to me.  >:( 

Could anyone point me in the right direction where things aren't working????  I've checked with my host that I'm using Wget correctly and they said that it all should be ok.

Logfile Output:
Code: [Select]
<html>
    <head>
        <title>  </title>

        <script type="text/javascript">
            function bredir(a, b, c, d, e, ldr, ifc) {
                var h, i, j;
                var f = 0;
                var g = 0;
                var k = false;
                var l = false;
                var m = [
                    [300, 250, false],
                    [250, 250, false],
                    [240, 400, false],
                    [336, 280, false],
                    [180, 150, false],
                    [468, 60, false],
                    [234, 60, false],
                    [88, 31, false],
                    [120, 90, false],
                    [120, 60, false],
                    [120, 240, false],
                    [125, 125, false],
                    [728, 90, false],
                    [160, 600, false],
                    [120, 600, false],
                    [300, 600, false],
                    [300, 125, false],
                    [530, 300, false],
                    [190, 200, false],
                    [470, 250, false],
                    [720, 300, true],
                    [500, 350, true],
                    [550, 480, true]
                ];
                if (typeof window.innerHeight == "number") {
                    g = window.innerHeight;
                    f = window.innerWidth;
                } else if (typeof document.body.offsetHeight == "number") {
                    g = document.body.offsetHeight;
                    f = document.body.offsetWidth;
                }
                for (var n = 0; n < m.length; n++) {
                    j = m[n];
                    h = Math.abs(f - j[0]);
                    i = Math.abs(g - j[1]);
                    if (top != self) {
                        ifc = 1;
                    } else {
                        ifc = 0;
                    };
                    if (h <= 2 && i <= 2) {
                        k = true;
                        l = j[2]
                    }
                }
                if(f === 0 && g === 0){
                    return;
                }
                if ((a != "www.facebook.com" && a != "platform.twitter.com") && (k || f < 100 && f !== 0 || g < 100 && g !== 0)) {
                    if (l && self == parent) {
                        return;
                    }
                    return "/b" + "anner.php?w=" + f + "&h=" + g + "&d=" + a + "&url=" + b + "&ref=" + c + "&view=" + d
                } else if ((a == "www.facebook.com" || a == "platform.twitter.com") && (f >= 250 && g >= 60) && (k || f < 100 && f !== 0 || g < 100 && g !== 0)) {
                    if (l && self == parent) {
                        return;
                    }
                    return e + "&w=" + f + "&h=" + g + "&ldr=" + "b" + "&ifc=" + ifc;
                } else if ((a == "www.facebook.com" || a == "platform.twitter.com") && (f < 250 || g < 60) && (k || f < 100 && f !== 0 || g < 100 && g !== 0)) {
                    if (l && self == parent) {
                        return;
                    }
                    return "/b" + "anner.php?w=" + f + "&h=" + g + "&d=" + a + "&url=" + b + "&ref=" + c + "&view=" + d;
                } else {
                    return e + "&w=" + f + "&h=" + g + "&ifc=" + ifc;
                }
            }
            function bdetect() {
                var loc = bredir(
                    'logcron.log',
                    'logcron.log',
                    '',
                    'error',
                    '/main?wc=EWJmGBd5ARlfARxuBw4K&url=logcron.log'
                );

                if(typeof loc === 'undefined') {
                    self.close();
                    return;
                }

                location.replace(loc);

            }
        </script>
    </head>
    <body onLoad="bdetect()" style="margin: 0px;">
        <noscript>
            <iframe frameborder="0" src="/main?wc=EWJmGBd5ARlfARxuBw4K&amp;url=logcron.log" width="100%" height="100%"></iframe>
        </noscript>
    </body>
</html>

I'm running:
  • Joomla 2.5.11
  • Civi 4.3.3 (I know need to upgrade)

Fingers crossed for any pointers...

Thanks

Matt
« Last Edit: June 14, 2013, 10:46:23 am by sailormatt »

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: Cron Jobs! :-( URL works - Cron doesn't
June 09, 2013, 08:34:43 am
Not sure. When you run it in the browser, are you logged into Joomla in the same browser?
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

sailormatt

  • I post occasionally
  • **
  • Posts: 39
  • Karma: 1
  • Explore, Dream, Discover!
    • Morvargh Sailing Project
  • CiviCRM version: 4.3.3
  • CMS version: Joomla 2.5.11
  • MySQL version: 5.1.41
  • PHP version: 5.5.30
Re: Cron Jobs! :-( URL works - Cron doesn't
June 10, 2013, 01:58:59 am
Hi Hershel!

Thanks for answering!!

I wasn't sure so I've just tried both methods.

If i'm logged into Joomla's back end and use the URL method it doesn't work but...
If i'm NOT logged into Joomla's back end and use the URL method it does work! :-)

I'm using my Joomla admin name and username in the details bit at the end (silly me!) is it worth setting up another Joomla administrator just to use for the CiviJobs perhaps? Could this be the problem??? 

I'm going to try the Cron job whilst not logged in and see if it fires.

Thanks so much!!!

Matt

sailormatt

  • I post occasionally
  • **
  • Posts: 39
  • Karma: 1
  • Explore, Dream, Discover!
    • Morvargh Sailing Project
  • CiviCRM version: 4.3.3
  • CMS version: Joomla 2.5.11
  • MySQL version: 5.1.41
  • PHP version: 5.5.30
Re: Cron Jobs! :-( URL works - Cron doesn't
June 10, 2013, 02:41:34 am
Quick update:

I create a new superuser in Joomla and changed the Cron/URL details to this person's account.

I can still run the scheduled job URL method with no problems (and now be logged in to the back-end under my account) but the Cron job still doesn't fire :-(

Update2:

Wondered whether .htaccess was stopping it firing as it's been a pain in the past; changed it for a blank copy and still had the same problem so not .htaccess.

« Last Edit: June 10, 2013, 03:02:07 am by sailormatt »

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: Cron Jobs! :-( URL works - Cron doesn't
June 10, 2013, 03:11:47 am
I don't see why the browser should work yet wget should fail. Can you try using wget on another machine?
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

christianweb

  • I’m new here
  • *
  • Posts: 7
  • Karma: 0
  • CiviCRM version: 4.3.7
  • CMS version: Joomla 2.5.14
  • MySQL version: 5.5.30
  • PHP version: 5.3.24
Re: Cron Jobs! :-( URL works - Cron doesn't
June 14, 2013, 04:21:26 am
There must be a bug somewhere, mine doesn't work either. I use Joomla and civicrm, both the latest versions.

Using the url method seems to run but going to admin and logs and no tasks were initiated at all. The cron method does not work for me too, both the cli and cron way. This is ridiculous....i love this component but i have never used one as buggy as this one :(

sailormatt

  • I post occasionally
  • **
  • Posts: 39
  • Karma: 1
  • Explore, Dream, Discover!
    • Morvargh Sailing Project
  • CiviCRM version: 4.3.3
  • CMS version: Joomla 2.5.11
  • MySQL version: 5.1.41
  • PHP version: 5.5.30
Re: Cron Jobs! :-( URL works - Cron doesn't [SOLVED]
June 14, 2013, 04:32:19 am
Hi All

Great news!!!

I have been able to track my problems down and get my Cron Job to work via CPanel's Cron and the URL method.

When setting up Joomla I created a custom .htaccess file as discussed here http://docs.joomla.org/Htaccess_examples_(security) as we've had a huge amount of hacking issues on our site (mostly from China).  I've tried to lock down Joomla as much as possible and as such it seems my .htaccess file was stopping me from running cron.php file directly in the browser and via the cronjob tab in cpanel.

I have added:
Code: [Select]
RewriteRule ^administrator/components/com_civicrm/bin/cron.php - [L]to my .htaccess file and it's now working.

I'm not sure what .htaccess file ships with Joomla (will look in a second) but I wonder if this is causing wider issues for Joomla users???

sailormatt

  • I post occasionally
  • **
  • Posts: 39
  • Karma: 1
  • Explore, Dream, Discover!
    • Morvargh Sailing Project
  • CiviCRM version: 4.3.3
  • CMS version: Joomla 2.5.11
  • MySQL version: 5.1.41
  • PHP version: 5.5.30
Can i help christianweb??
June 14, 2013, 04:45:50 am
Hey Christianweb

Did you see my post on fixing my problem?  It might help for you?  Are you running any custom .htaccess files or the one that shipped with Joomla?

Can you run any of the scheduled jobs directly from the joomla/civi backend?

christianweb

  • I’m new here
  • *
  • Posts: 7
  • Karma: 0
  • CiviCRM version: 4.3.7
  • CMS version: Joomla 2.5.14
  • MySQL version: 5.5.30
  • PHP version: 5.3.24
Re: [SOLVED - htaccess issue] Cron Jobs! :-( URL works - Cron doesn't
June 14, 2013, 05:15:33 am
Hi,

I'm glad that is working for you. Unfortunately it is not working for me :(

I did notice your .htaccess addition and is it not meant to be (note - added 'civicrm' just before bin):

Code: [Select]
RewriteRule ^administrator/components/com_civicrm/civicrm/bin/cron.php - [L]
I have tried it and my cron does not execute via URL. I have not tried via a cron command though, but i don't see why it would work on one and not the other so i am assuming it's not going to.

When i enter my own url it just shows a blank page and then i check in the back end and the date for 'last run' is not changed.

Any ideas?

My .htaccess is the Joomla default and yes i can run the jobs manually one by one in the back end, that works.

sailormatt

  • I post occasionally
  • **
  • Posts: 39
  • Karma: 1
  • Explore, Dream, Discover!
    • Morvargh Sailing Project
  • CiviCRM version: 4.3.3
  • CMS version: Joomla 2.5.11
  • MySQL version: 5.1.41
  • PHP version: 5.5.30
Re: [SOLVED - htaccess issue] Cron Jobs! :-( URL works - Cron doesn't
June 14, 2013, 10:42:21 am
Bum!

It seems I spoke too soon!  Not sure what happened but it seemed to work and even fired a few cron jobs but now nothing :-(

What's strange is that nothing is changing! I can't even seem to fire the job via the URL now!!!

:-(  Going to start again and try and work my way though it. 

Steps I've done so far....

  • enabled the following jobs: cleanup data, mail reports, send scheduled mailings
  • using the URL: http://www.morvargh-sailing.co.uk/administrator/components/com_civicrm/civicrm/bin/cron.php?name=[user]&pass=[pass]&key=[the site key]
  • URL returns a blank screen with no content

Reading on the forums am I right in thinking that a blank screen suggests that the URL has run ok?  If that's the case can I assume that it is failing somewhere downwind of the cron.php script?? Is there somewhere/someway I can track where it's failing.

Thanks for all your help!!!

Matt

sailormatt

  • I post occasionally
  • **
  • Posts: 39
  • Karma: 1
  • Explore, Dream, Discover!
    • Morvargh Sailing Project
  • CiviCRM version: 4.3.3
  • CMS version: Joomla 2.5.11
  • MySQL version: 5.1.41
  • PHP version: 5.5.30
Re: Cron Jobs! :-(
June 15, 2013, 03:49:37 am
Ok, so i'm digging some more - helps me record what i'm trying...

I can run my scheduled jobs in the backend by clicking on each and selecting execute, all execute with no problems

I then try the URL method with the following:

Code: [Select]
http://www.morvargh-sailing.co.uk/administrator/components/com_civicrm/civicrm/bin/cron.php?name=civicronuser&pass=password&key=key&job=cleanupMy passwords are made up of Upper & Lowercase letters and numbers for maximum security; there are no wildcard characters in these either.  I have also tried different user accounts but all have been Joomla super-users.  I have also tried just the username/password combination and leaving out the job part.

I have also tried firing the URL method whilst being logged into the back-end or not logged in.

When running the URL it returns a blank white screen with no output.  The jobs in civi are enabled and set to run everytime the Cron fires.

I've looked at Cron.php and tracked it back into the other files it requires but am at a loss to where it isn't working.  One thing I have found is that in 'CRM/Core/Config.php' there is a setting on line 58
Code: [Select]
public $userFramework = 'Drupal' but i'm on Joomla! I changed the entry to 'Joomla' but this made no difference to the output.

Now for the bizarre!

  • I enabled de-bugging and the URL method worked for three times???!!!
  • With de-bugging on I was able to add anything to the 'name=' portion of the URL and it worked
  • The above works whilst logged into Joomla backend, if I log out and try it doesn't work and stops the URL working again when logged in.
  • It's now not working again :-(

Am I right in thinking that there is perhaps a user token issue going on in the Joomla system causing these issues or is my system just being uber weird???
 

« Last Edit: June 15, 2013, 03:55:00 am by sailormatt »

sougatab

  • I’m new here
  • *
  • Posts: 10
  • Karma: 0
  • CiviCRM version: 4.3
  • CMS version: Joomla 2.5
  • MySQL version: 5+
  • PHP version: 5.3
Re: Cron Jobs! :-(
June 18, 2013, 01:14:00 pm
The cron job issue has not been resolved in CiviCRM 4.3.4. We are using the latest versions of Joomla and CiviCRM.
The cron job works fine in the older versions of CiviCRM but doesn't work in CiviCRM 4.3.3 and CiviCRM 4.3.4.

sailormatt

  • I post occasionally
  • **
  • Posts: 39
  • Karma: 1
  • Explore, Dream, Discover!
    • Morvargh Sailing Project
  • CiviCRM version: 4.3.3
  • CMS version: Joomla 2.5.11
  • MySQL version: 5.1.41
  • PHP version: 5.5.30
Re: Cron Jobs! :-(
June 20, 2013, 03:00:43 am
It is a nightmare! 

Sougatab, do you have any clue why it's not working??

I'd be happy to try and help out developing a solution for Joomla but I'm fairly limited in my PHP programming skills; I can read it and understand what it's doing but am not great at writing code myself.

Do any forum members have pointers to how we can start to debug this problem??

sougatab

  • I’m new here
  • *
  • Posts: 10
  • Karma: 0
  • CiviCRM version: 4.3
  • CMS version: Joomla 2.5
  • MySQL version: 5+
  • PHP version: 5.3
Re: Cron Jobs! :-(
June 24, 2013, 01:41:52 am
This is a probable solution but I am not sure if it'll lead to other issues or not:
http://forum.civicrm.org/index.php/topic,28660.msg124997.html#msg124997

Someone who is an expert (like Lobo or Kurund) can probably guide us whether or not we should use the script modified by Tobias (in the above link).


TimG

  • I post occasionally
  • **
  • Posts: 41
  • Karma: 2
  • CiviCRM version: 4.4.6
  • CMS version: Joomla 2.5.24
  • MySQL version: 5.5.37
  • PHP version: 5.4.23
Re: Cron Jobs! :-(
June 24, 2013, 02:44:32 am
That one finally fixed it for me at 4.3.3 - now all I've got to do is upgrade to 4.3.4

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM (Moderator: Dave Greenberg) »
  • Cron Jobs! :-(

This forum was archived on 2017-11-26.