0

I have spent the last two weeks trying to get Cron Jobs with cPanel run Scheduled Jobs in CiviCRM. Literally everything I have tried does not work as a command in Cron Jobs but when using SSH I have been able to get this to trigger the job to run:

wget -q -O - "http://website.com/wp-content/plugins/civicrm/civicrm/bin/cron.php?name=websiteAdmin&pass=websiteAdminPassword&key=1234567912345678912345678912345"

But when I take this exact command that works via SSH and put it into Cron Jobs I get an email stating:

/bin/sh: -c: line 0: unexpected EOF while looking for matching `"'
/bin/sh: -c: line 1: syntax error: unexpected end of file

My next idea was to remove the quotation marks before and after the link, which then failed due to invalid token, the password has symbols in it, so I escaped them using \ before each special character. Then I get:

ERROR: You need to send a valid key to execute this file. More info at:http://wiki.civicrm.org/confluence/display/CRMDOC/Managing+Scheduled+Jobs

At this point, I know for a fact the key is correct since this command runs via SSH and the key never changed every time so far. The escaped characters are only within the password.

I have tried many other things but I figured a log file explanation might be overkill, anyone have any ideas?

Using: cPanel version 11.52.3 (build 1) CiviCRM version 4.6 WordPress 4.4.2

5
  • Have you tried escaping also the ampersand characters in the string? ie. \&pass...\&key...
    – Andrei
    Commented Feb 29, 2016 at 19:44
  • Yes, when I escape the additional characters after the ? I get: ERROR: You need to send a valid user name and password to execute this file That was a good idea, I thought for sure it would solve it too. Using: cPanel version 11.52.3 (build 1) CiviCRM version 4.6
    – LJB
    Commented Mar 1, 2016 at 14:31
  • When I was testing this, it seemed that system checked the key before it checked the Username/Password. You could quick test this theory by escaping things and entering the wrong key. A return of invalid key would then show the key is being tested first. This is the reason I ended up having to go to WP-CLI. I was getting the same type of errors with curl.
    – G H
    Commented Mar 1, 2016 at 16:31
  • I have been working towards getting WP-CLI to do the job for me and have run into another issue. When doing this command wp eval-file http://website.org/wp-content/plugins/civicrm/civicrm/bin/cron.php name=websiteAdmin pass=websiteAdminPassword key=1234567912345678912345678912345 --path=/home8/farrnetw/public_html/ It returns: Fatal error: Class 'WP_Widget' not found in /home8/thing/public_html/wp-content/plugins/image-widget/image-widget.php on line 25 I did som checking around and all I can find is people having install issues, which is not the case here since this has been up
    – LJB
    Commented Mar 4, 2016 at 16:35
  • Solved the issue, used this line to get it to run wget -O /dev/null -q -t 1 'http://website.org/wp-content/plugins/civicrm/civicrm/bin/cron.php?name=web_admin&pass=web_pass&key=web_key' but i had to only escape a % symbol that was in the password and not escape any of the other special characters.
    – LJB
    Commented Mar 7, 2016 at 15:30

2 Answers 2

1

You don't say what version of anything you are running, or if you upgraded or did a new install. If this is a 4.7 upgrade, I had similar issues and had to resort to installing and using the WP-CLI method. If you go that route, you probably also want to take a look at this: WP-CLI using GMT/UTC Timezone on cron jobs

1
  • Sorry, slipped my mind to include the versions, I might have to resort to WP-CLI, thank you for the suggestion. Using: cPanel version 11.52.3 (build 1) CiviCRM version 4.6 WordPress 4.4.2
    – LJB
    Commented Mar 1, 2016 at 15:18
0

Not sure if I'm on the right track here, but what if you created a separate one-liner script with just the wget command you're trying to run and executed said script from cron?

1
  • Good idea, I have tried it, for some reason Cron always reports back saying no such file or directory. I am still trying many things and this idea has not been crossed off just yet.
    – LJB
    Commented Mar 1, 2016 at 15:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.