4

I've tried different ways to setup cron jobs.

When using that cron job, the file is not able to read the parameters (like key, etc.)

/usr/bin/wget -O - -q -t 1 http://www.site.org/wp-content/plugins/civicrm/civicrm/bin/cron.php?name=XXXX&pass=XXXX&key=XXXXX

The e-mail I received says: ERROR: You need to send a valid key to execute this file.

When using those cron jobs, they are not running:

/usr/bin/wget -O - -q -t 1 'http://www.xxxx.org/wp-content/plugins/civicrm/civicrm/bin/cron.php?name=XXXX&pass=XXXX&key=XXXXX'

/usr/bin/wget -O - -q -t 1 "http://www.xxxxx.org/wp-content/plugins/civicrm/civicrm/bin/cron.php?name=XXXX&pass=XXXX&key=XXXXX"

When working with php-cli:

php /home2/xxx/public_html/wp-content/plugins/civicrm/civicrm/bin/cli.php -s xxxxx.org -u XXXX -p XXXXX -e Job -a execute

The PHP error log says:

PHP Fatal error: cli.php can only be run from command line. in /home2/xxxxx/public_html/wp-content/plugins/civicrm/civicrm/bin/cli.class.php on line 91

When submitting the link directly in the browser, it works well.

PHP 5.4.43 CiviCRM 4.6.7 Wordpress 4.4.1

3

You may want to try creating a wgetrc file that contains all your values. Check the man page for wget as a reference.. Here's a wgetrc of mine:

post-data=name=civicron&pass=<password>&key=<sitekey>
output_document = -
quiet=on
timeout=1

Also - check your Apache/nginx logs for the actual URL that was requested that corresponds to a wget that resulted in a "You need to send a valid key" error. Maybe something is getting truncated; the web server log can help determine this.

3

Thanks for helping. Looking at the log showed that everything after & was getting truncated.

There should be "backslash" () sign before "and" (&) sign.

/usr/bin/wget -O - -q -t 1 http://www.site.org/wp-content/plugins/civicrm/civicrm/bin/cron.php?name=XXXX\&pass=XXXX\&key=XXXXX

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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