1

为什么我会收到这些错误?

Unknown command pass=user.
Unknown command key=site-key.

可能是因为我使用的是lftp还是什么?

这是我的 bash 脚本:

#!/bin/sh

##########################################################################
#
# Send queued CiviMail and process back channel for CiviCRM v2.2+
# Make this executable and invoke from cron every (say) 15 minutes
# Not yet tested: no lock on this if previous cron hadn't finished
# but civimail.cronjob.php and CiviMailProcessor.php are multi-entrant
#
##########################################################################
#
# Per-host configuration
#

drupalAuthUser='user'
drupalAuthPass='password'
civicrmSiteKey='site-key'

imapHost='civicrm.example.org'
imapUser='civicrm@example.org'
#imapPass='password'
#
# Prepare URL
#
crmbinurl="http://$imapHost/sites/all/modules/civicrm/bin"
crmauthn="?name=$drupalAuthUser&pass=$drupalAuthPass&key=$civicrmSiteKey"
#
echo "Run Drupal cron then check for and send queued CiviMail"
### Heading ##
civimail="${crmbinurl}/civimail.cronjob.php${crmauthn}"
echo $civ
## Heading ##imail
lftp -c "get $civimail > /dev/null"
#
# Wait 10 seconds
#
sleep 2
#
# echo "Process CiviMail backchannel"
#
backchan="${crmbinurl}/CiviMailProcessor.php${crmauthn}"
echo $backchan
## Heading ##
lftp -c "get $backchan > /dev/null"

运行./civicrmcron.sh给出以下输出:

Run Drupal cron then check for and send queued CiviMail
http://civicrm.example.org/sites/all/modules/civicrm/bin/civimail.cronjob.php?name=user&pass=password&key=site-key
Unknown command `pass=user'.
Unknown command `key=site-key'.
[22328] Moving to background to complete transfers...
http://civicrm.example.org/sites/all/modules/civicrm/bin/civimail.cronjob.php?name=user&pass=password&key=site-key
Unknown command `pass=user'.
Unknown command `key=site-key'.
[22332] Moving to background to complete transfers...
4

2 回答 2

1

这是因为您在 URL 中为 $crmauthn 使用了与号。如果您使用单引号,它应该可以工作:

crmauthn='?name='${drupalAuthUser}'&pass='${drupalAuthPass}'&key='${civicrmSiteKey}

或者:

crmauth="'?name='${drupalAuthUser}'&pass='${drupalAuthPass}'&key='${civicrmSiteKey}"
于 2011-07-30T17:51:17.363 回答
0

使用链接而不是lftp

#!/bin/bash

drupalAuthUser="user"
drupalAuthPass="password"
civicrmSiteKey="site-key"

imapHost="civicrm.example.org"
imapUser="civicrm@example.org"
imapPass="password"

crmbinurl="http://${imapHost}/sites/all/modules/civicrm/bin"
crmauthn="?name=${drupalAuthUser}&pass=${drupalAuthPass}&key=${civicrmSiteKey}"

echo "CiviMail CronJob"
civimail="${crmbinurl}/civimail.cronjob.php${crmauthn}"
echo "  * ${civimail}"
links -source ${civimail} > /dev/null

sleep 2

echo "Process CiviMail backchannel"
backchan="${crmbinurl}/CiviMailProcessor.php${crmauthn}"
echo "  * ${backchan}"
links -source $backchan > /dev/null
于 2011-07-30T20:40:05.883 回答