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 »
  • Post-installation Setup and Configuration (Moderator: Dave Greenberg) »
  • Using UpdateGreeting.php with PHP-CLI
Pages: [1]

Author Topic: Using UpdateGreeting.php with PHP-CLI  (Read 953 times)

kmarkley

  • I post frequently
  • ***
  • Posts: 178
  • Karma: 14
  • CiviCRM version: 4.4.3
  • CMS version: Drupal 7.24
  • MySQL version: 5.1.56
  • PHP version: 5.3.27
Using UpdateGreeting.php with PHP-CLI
December 31, 2010, 11:07:26 am
I've been switching all my cron scripts from wget to php-cli.  Most are working fine, but I don't understand how to pass the additional arguments (ct, gt, and id) to the update greeting script when not using a URL.  I'm sure its something simple. 

Thanks.

mdlueck

  • Ask me questions
  • ****
  • Posts: 382
  • Karma: 4
  • CiviCRM version: 4.7.24
  • CMS version: Drupal 6.x
  • MySQL version: 5.5.54
  • PHP version: 5.3.10
Re: Using UpdateGreeting.php with PHP-CLI
January 01, 2011, 01:35:25 pm
Perhaps the same solution we are using for UpdateMembershipRecord.php will work for this PHP...

Code: [Select]
#!/bin/bash

umask 002
DATETIME=`/bin/date +%Y%m%d-%H%M%S`

PARAMS='-sdefault -ucivicrm-cron -pPASSWORD'

cd /srv/www/sites/domain.org/www/sites/all/modules/civicrm
/usr/bin/nice -n19 /usr/bin/php bin/UpdateMembershipRecord.php $PARAMS 2>&1 | /usr/bin/tee -a /srv/www/reports/$DATETIME.cir.civicrm-civimember.UpdateMembershipRecord.php.sh.log
--
Michael Lueck
Lueck Data Systems
http://www.lueckdatasystems.com/

kmarkley

  • I post frequently
  • ***
  • Posts: 178
  • Karma: 14
  • CiviCRM version: 4.4.3
  • CMS version: Drupal 7.24
  • MySQL version: 5.1.56
  • PHP version: 5.3.27
Re: Using UpdateGreeting.php with PHP-CLI
January 03, 2011, 07:06:31 am
Thanks for the suggestion, but I don't think that helps (or else I'm not understanding something).

The UpdateGreeting.php script has more arguments in addition to the username, password that all the cron scripts share.  Specifically, it takes greeting type and contact type arguments.  When invoked by URL, these are passed by 'gt=' and 'ct='.

I don't know how to pass these arguments in the CLI call.   Maybe I'm just not getting it, or maybe it is impossible.

Thanks.

mdlueck

  • Ask me questions
  • ****
  • Posts: 382
  • Karma: 4
  • CiviCRM version: 4.7.24
  • CMS version: Drupal 6.x
  • MySQL version: 5.5.54
  • PHP version: 5.3.10
Re: Using UpdateGreeting.php with PHP-CLI
January 03, 2011, 11:19:42 am
Quote from: kmarkley on January 03, 2011, 07:06:31 am
When invoked by URL, these are passed by 'gt=' and 'ct='.

I don't know how to pass these arguments in the CLI call.   Maybe I'm just not getting it, or maybe it is impossible.

I would think per my example code you would simply add those additional args to the PARAMS variable before calling UpdateGreeting.php, no?

Can you do what you want to do with wget, or not even that way? If it is possible with wget, then it should be possible with CLI.
--
Michael Lueck
Lueck Data Systems
http://www.lueckdatasystems.com/

kmarkley

  • I post frequently
  • ***
  • Posts: 178
  • Karma: 14
  • CiviCRM version: 4.4.3
  • CMS version: Drupal 7.24
  • MySQL version: 5.1.56
  • PHP version: 5.3.27
Re: Using UpdateGreeting.php with PHP-CLI
January 03, 2011, 11:26:54 am
Thanks, that is exactly my question.  With wget I would include, for instance:

user=USERNAME&pass=PASSWORD&ct=CONTACT_TYPE

So I guess you're saying that with CLI I can just do this in the params?

-uUSERNAME -pPASSWORD -ctCONTACT_TYPE

I wasn't sure (because of the difference between 'user=USERNAME' and '-uUSERNAME') what the right format was for the additional arguments.

mdlueck

  • Ask me questions
  • ****
  • Posts: 382
  • Karma: 4
  • CiviCRM version: 4.7.24
  • CMS version: Drupal 6.x
  • MySQL version: 5.5.54
  • PHP version: 5.3.10
Re: Using UpdateGreeting.php with PHP-CLI
January 04, 2011, 05:08:57 pm
Quote from: kmarkley on January 03, 2011, 11:26:54 am
So I guess you're saying that with CLI I can just do this in the params?

Exactly, change that variable to the command line params you need to send to this particular script, and give it a whirl!  ;D
--
Michael Lueck
Lueck Data Systems
http://www.lueckdatasystems.com/

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Post-installation Setup and Configuration (Moderator: Dave Greenberg) »
  • Using UpdateGreeting.php with PHP-CLI

This forum was archived on 2017-11-26.