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 »
  • Drupal Installations (Moderator: Piotr Szotkowski) »
  • mail processing cron jobs not working using shell method
Pages: [1] 2

Author Topic: mail processing cron jobs not working using shell method  (Read 2428 times)

tobiaseigen

  • I post frequently
  • ***
  • Posts: 151
  • Karma: 5
    • Kabissa - Space for Change in Africa
mail processing cron jobs not working using shell method
October 28, 2012, 10:51:07 am
Hi everyone,

I'm having a problem with mail processing cron jobs and would be grateful for advice. Thanks! :)
I am on drupal 6, civicrm 3.4.7, plesk.

I have been trying to figure out how to get the recommended shell script working in cron to process mail, and am getting the following notification from cron:

Error: Could not create directory: /path/to/httpdocs/files.<p>If you have moved an existing CiviCRM installation from one location or server to another there are several steps you will need to follow. They are detailed on this CiviCRM wiki page - <a href="http://wiki.civicrm.org/confluence/display/CRMDOC/Moving+an+Existing+Installation+to+a+New+Server+or+Location"  target="_blank" title="Opens documentation in a new window.">Moving an Existing Installation to a New Server or Location</a>. A fix for the specific problem that caused this error message to be displayed is to set the value of the config_backend column in the civicrm_domain table to NULL. However we strongly recommend that you review and follow all the steps in that document.</p>

I explored those instructions but I think for my problem this is not the solution, but rather I am suspecting a permissions issue. Which user should cron be running under? I tried a bunch of them on my plesk system (apache, psaadm, root) and all of them give this same error.

My crontab is below, with the shell scripts commented out and the wget method currently active and working.

Cheers,

Tobias

-- cut here --

# This must be set to the directory where civicrm is installed.
CIVI_ROOT='/path/to/httpdocs/sites/all/modules/civicrm'


# Comment: I believe these two lines are unnecessary.
# USER=www-data
MAILTO=foo@bar.org


# Location of the PHP Command Line Interface binary.
# nice -19 forces to run at a lower priority than the web server
PHP=nice -n19 /usr/bin/php


# line to be modified according to the informations below
# like this: PARAMS= -s<default or domain> -u<user> -p<password>
PARAMS= -s<domain> -u<user> -p<pass>


# cronjob send
# m h dom mon dow command
# */5 * * * * cd $CIVI_ROOT; $PHP bin/civimail.cronjob.php $PARAMS
*/5 *   * * * wget 'http://www.kabissa.org/sites/all/modules/civicrm/bin/civimail.cronjob.php?name=<name>&pass=<pass>&key=<key>'
# */15 * * * * cd $CIVI_ROOT; $PHP bin/EmailProcessor.php $PARAMS
*/15 * * * * wget 'http://www.kabissa.org/sites/all/modules/civicrm/bin/EmailProcessor.php?name=<name>&pass=<pass>&key=<key>'
52 * * * * wget -q http://www.kabissa.org/cron.php
Kabissa - Space for Change in Africa http://kabissa.org

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: mail processing cron jobs not working using shell method
October 28, 2012, 11:04:29 am
Quote from: tobiaseigen on October 28, 2012, 10:51:07 am
# This must be set to the directory where civicrm is installed.
CIVI_ROOT='/path/to/httpdocs/sites/all/modules/civicrm'

Hi. The instructions there say "This must be set to the directory where civicrm is installed." You have not done that. You must edit the CIVI_ROOT value to be the correct path on your server.
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.

tobiaseigen

  • I post frequently
  • ***
  • Posts: 151
  • Karma: 5
    • Kabissa - Space for Change in Africa
Re: mail processing cron jobs not working using shell method
October 28, 2012, 11:06:26 am
thanks for the quick reply! :) I actually did do this but munged it in my post to the forum.
Kabissa - Space for Change in Africa http://kabissa.org

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: mail processing cron jobs not working using shell method
October 28, 2012, 11:08:21 am
Your error "Error: Could not create directory: /path/to/httpdocs/files." indicates that " /path/to/httpdocs/" is still somewhere in there. Can you post the full cron tab as it really is then?
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.

tobiaseigen

  • I post frequently
  • ***
  • Posts: 151
  • Karma: 5
    • Kabissa - Space for Change in Africa
Re: mail processing cron jobs not working using shell method
October 28, 2012, 11:36:24 am
sorry if this is getting confusing. I had munged it in the error also. Here's the original error followed by the original cron with the email/user/password/key info munged.

-- cut here --

Error: Could not create directory: /var/www/vhosts/kabissa.org/httpdocs/files.<p>If you have moved an existing CiviCRM installation from one location or server to another there are several steps you will need to follow. They are detailed on this CiviCRM wiki page - <a href="http://wiki.civicrm.org/confluence/display/CRMDOC/Moving+an+Existing+Installation+to+a+New+Server+or+Location"  target="_blank" title="Opens documentation in a new window.">Moving an Existing Installation to a New Server or Location</a>. A fix for the specific problem that caused this error message to be displayed is to set the value of the config_backend column in the civicrm_domain table to NULL. However we strongly recommend that you review and follow all the steps in that document.</p>

-- cut here --

# This must be set to the directory where civicrm is installed.
CIVI_ROOT='/var/www/vhosts/kabissa.org/httpdocs/sites/all/modules/civicrm'


# Comment: I believe these two lines are unnecessary.
# USER=www-data
MAILTO=<email>


# Location of the PHP Command Line Interface binary.
# nice -19 forces to run at a lower priority than the web server
PHP=nice -n19 /usr/bin/php


# line to be modified according to the informations below
# like this: PARAMS= -s<default or domain> -u<user> -p<password>
PARAMS= -<domain> -<user> -<pass>


# cronjob send
# m h dom mon dow command
# */5 * * * * cd $CIVI_ROOT; $PHP bin/civimail.cronjob.php $PARAMS
*/5 *   * * * wget -O - -q -t 1 'http://www.kabissa.org/sites/all/modules/civicrm/bin/civimail.cronjob.php?name=<user>&pass=<pass>&key=<key>'
# */15 * * * * cd $CIVI_ROOT; $PHP bin/EmailProcessor.php $PARAMS
*/15 * * * * wget -O - -q -t 1 'http://www.kabissa.org/sites/all/modules/civicrm/bin/EmailProcessor.php?name=<user>&pass=<pass>&key=<key>'
52 * * * * wget -q http://www.kabissa.org/cron.php
Kabissa - Space for Change in Africa http://kabissa.org

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: mail processing cron jobs not working using shell method
October 28, 2012, 11:45:10 am
Does /var/www/vhosts/kabissa.org/httpdocs/files exist? If not, can you create that?
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.

tobiaseigen

  • I post frequently
  • ***
  • Posts: 151
  • Karma: 5
    • Kabissa - Space for Change in Africa
Re: mail processing cron jobs not working using shell method
October 28, 2012, 11:51:27 am
yes - that path exists already.
Kabissa - Space for Change in Africa http://kabissa.org

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: mail processing cron jobs not working using shell method
October 28, 2012, 12:39:10 pm
I'm not sure why it's failing. You say the wget method works? Why do you want to change methods?
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.

tobiaseigen

  • I post frequently
  • ***
  • Posts: 151
  • Karma: 5
    • Kabissa - Space for Change in Africa
Re: mail processing cron jobs not working using shell method
October 28, 2012, 02:22:40 pm
yes, the wget method works.

i want to change it because it's possible to set the cron job at a lower priority than web processes, and it also makes me uneasy to have the login user/pass being constantly recorded in apache log files and in emails. it's recommended in the docs as well.

maybe i will leave it as it is for now and revisit this at the next civi upgrade.

thanks for thinking this through with me.

-t
Kabissa - Space for Change in Africa http://kabissa.org

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: mail processing cron jobs not working using shell method
October 28, 2012, 02:58:58 pm
Hi Tobias,

Are you running the cron as www-data? Might be an access right issue too.

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: mail processing cron jobs not working using shell method
October 28, 2012, 03:32:46 pm
Quote from: tobiaseigen on October 28, 2012, 02:22:40 pm
i want to change it because it's possible to set the cron job at a lower priority than web processes

This can be an issue if your server is overloaded, yes.

Quote from: tobiaseigen on October 28, 2012, 02:22:40 pm
it also makes me uneasy to have the login user/pass being constantly recorded in apache log files and in emails.

If a hacker has access to your Apache logs, then he has access to your settings.php anyway so it makes no difference really that the user/pass are in the logs, IMO.

As far as emails, you should disable that.

Quote from: tobiaseigen on October 28, 2012, 02:22:40 pm
it's recommended in the docs as well.

Yes, Xavier prefers it. :)
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.

tobiaseigen

  • I post frequently
  • ***
  • Posts: 151
  • Karma: 5
    • Kabissa - Space for Change in Africa
Re: mail processing cron jobs not working using shell method
October 28, 2012, 05:22:43 pm
Quote from: xavier on October 28, 2012, 02:58:58 pm
Are you running the cron as www-data? Might be an access right issue too.
Thanks for weighing in, X - appreciate it. My server doesn't have a www-data user. I've tried various users but none of them seem to work, even root.

Cheers,

Tobias
Kabissa - Space for Change in Africa http://kabissa.org

tobiaseigen

  • I post frequently
  • ***
  • Posts: 151
  • Karma: 5
    • Kabissa - Space for Change in Africa
SOLVED? Re: mail processing cron jobs not working using shell method
October 28, 2012, 05:48:03 pm
well, that's exciting - switching the cron user to apache seems to have done the trick. It runs now without any email notifications. I also changed the ownership of the files folder to kabissa:psaadm which on my server is readable by the web server. So I will watch it and let you know if I learn anything new, but permissions seems to be the issue in this case.

Cheers,

Tobias
Kabissa - Space for Change in Africa http://kabissa.org

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: mail processing cron jobs not working using shell method
October 29, 2012, 12:21:36 am
Quote from: Hershel on October 28, 2012, 03:32:46 pm
Yes, Xavier prefers it. :)

Don't remember who did a proper benchmark, but it's an order of magnitude faster as well it seems ;)
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

tobiaseigen

  • I post frequently
  • ***
  • Posts: 151
  • Karma: 5
    • Kabissa - Space for Change in Africa
Re: mail processing cron jobs not working using shell method
October 29, 2012, 06:20:43 am
well, i would prefer it too if that's the case! :)

unfortunately I checked it again this morning and I am getting the same notification errors again, so have switched back to wget method.
Kabissa - Space for Change in Africa http://kabissa.org

Pages: [1] 2
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Installing CiviCRM »
  • Drupal Installations (Moderator: Piotr Szotkowski) »
  • mail processing cron jobs not working using shell method

This forum was archived on 2017-11-26.