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 »
  • Installing CiviCRM »
  • Joomla! Installations (Moderator: Deepak Srivastava) »
  • Cron via CLI
Pages: [1]

Author Topic: Cron via CLI  (Read 3956 times)

Lazlo Bakk

  • I’m new here
  • *
  • Posts: 10
  • Karma: 0
    • Okoshonlapok
  • CiviCRM version: 4.5.5
  • CMS version: Joomla, Drupal
  • MySQL version: 5.5
  • PHP version: 4.4
Cron via CLI
January 19, 2015, 10:47:44 am
CiviCRM installation guide says that cron via cli should be like this:
Code: [Select]
php /path/to/civicrm/bin/cli.php -s site -u user -p password -e Job -a execute
What heck the [-s site] would be? My site is biokutatas.hu, and it has a site key too. What supposed to write to the [site] section?
My cron code is:
Code: [Select]
php -q -f /home/.../com_civicrm/civicrm/bin/cli.php -s biokutatas.hu -u [superusername] -p [password] -e Job -a executeAll I can get is an error message:
Code: [Select]
require_once ('cli.class.php');
$cli = new civicrm_Cli();
$cli->initialize() || die( 'Died during initialization' );
$cli->callApi() || die( 'Died during callApi' );
How can I get this to work?

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Cron via CLI
January 20, 2015, 01:42:36 am
Hi Lazlo,

i'm not familiar with joomla, but the site is the way for drupal to distinguish between multiple sites sharing the same code base. Have you tried without the -s param?

What error message do you get? you put php code, not the exact error message. does it mean you get php code displayed as a result of running the command?
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Lazlo Bakk

  • I’m new here
  • *
  • Posts: 10
  • Karma: 0
    • Okoshonlapok
  • CiviCRM version: 4.5.5
  • CMS version: Joomla, Drupal
  • MySQL version: 5.5
  • PHP version: 4.4
Re: Cron via CLI
January 20, 2015, 10:14:19 pm
Well, I've left out the -s switch, now I get a different error message from the Cpanel cron running email notification:
Code: [Select]
Error in argument 4, char 2: option not found u
Usage: php [-q] [-h] [-s] [-v] [-i] [-f <file>]
       php <file> [args...]
  -a               Run interactively
  -b <address:port>|<port> Bind Path for external FASTCGI Server mode
  -C               Do not chdir to the script's directory
  -c <path>|<file> Look for php.ini file in this directory
  -n               No php.ini file will be used
  -d foo[=bar]     Define INI entry foo with value 'bar'
  -e               Generate extended information for debugger/profiler
  -f <file>        Parse <file>.  Implies `-q'
  -h               This help
  -i               PHP information
  -l               Syntax check only (lint)
  -m               Show compiled in modules
  -q               Quiet-mode.  Suppress HTTP Header output.
  -s               Display colour syntax highlighted source.
  -v               Version number
  -w               Display source with stripped comments and whitespace.
  -z <file>        Load Zend extension <file>.
  -T <count>       Measure execution time of script repeated <count> times.

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Cron via CLI
January 21, 2015, 02:07:52 am
Quote from: Lazlo Bakk on January 20, 2015, 10:14:19 pm
Can you write the exact line you tried?
it looks like a php command line got confused on something.

Also, do you have access from the command line (ssh?) it will be much easier for you to test and weed out some type of errors (the environment when you run from cron is slightly different than from the command line
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Lazlo Bakk

  • I’m new here
  • *
  • Posts: 10
  • Karma: 0
    • Okoshonlapok
  • CiviCRM version: 4.5.5
  • CMS version: Joomla, Drupal
  • MySQL version: 5.5
  • PHP version: 4.4
Re: Cron via CLI
January 21, 2015, 12:51:09 pm
My hands are tied. I have only a Cpanel with a cli based cron, without any url based cron. The cron via url is working perfectly if I call it from the browser - maybe I'll end with an easycron subcription.

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: Cron via CLI
January 22, 2015, 03:30:24 am
Have you tried using

Code: [Select]
wget "URL"
from CLI?
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.

Lazlo Bakk

  • I’m new here
  • *
  • Posts: 10
  • Karma: 0
    • Okoshonlapok
  • CiviCRM version: 4.5.5
  • CMS version: Joomla, Drupal
  • MySQL version: 5.5
  • PHP version: 4.4
Re: Cron via CLI
January 22, 2015, 08:39:52 am
I type:
Code: [Select]
wget http://biokutatas.hu/administrator/components/com_civicrm/civicrm/bin/cron.php?name.....This is what I get:
Code: [Select]
Resolving biokutatas.hu... 5.56.33.1
Connecting to biokutatas.hu|5.56.33.1|:80... connected.
HTTP request sent, awaiting response... 401 Authorization Required
Authorization failed.

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: Cron via CLI
January 22, 2015, 08:43:12 am
See here

http://stackoverflow.com/questions/4272770/wget-with-authentication

for how to add HTTP authentication to your wget command.
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.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Installing CiviCRM »
  • Joomla! Installations (Moderator: Deepak Srivastava) »
  • Cron via CLI

This forum was archived on 2017-11-26.