Opened 7 years ago

Last modified 7 years ago

#5528 assigned Bug/Something is broken

Drupal 7 crontab quirk

Reported by: Ross Owned by: Jamie McClelland
Priority: Medium Component: Tech
Keywords: drupal7 cron Cc: nat@…
Sensitive: no

Description

Playing around with crontab -e on a Drupal 7 site, I discovered that I couldn't alter the frequency of the cron job being executed without using the keyed cron created by the default installation. The original entry looked like this:

*/1 * * * * wget -q -O - http://deleuzer.net/cron.php

The entry that works looks like this:

*/5 * * * * wget -q -O - http://deleuzer.net/cron.php?cron_key=uMJNANlvajPJ8zt7QT0cVPAnsHptfMQHBpY

The keyed entry lives at /admin/reports/status . I'm not sure what should be done about this or if it's something we should attempt to automate the creation of.

Any thoughts?

~/ross

Change History (15)

comment:1 Changed 7 years ago by Ross

Owner: set to Ross
Status: newassigned

comment:2 Changed 7 years ago by Daniel Kahn Gillmor

I can't find any documentation about keyed cron for drupal other than a plugin for drupal 6, which i don't think is what you're talking about. Was there a change someplace? Could you link to documentation?

Given that all the MOSHes have drush installed, is there a reason we're using a wget-triggered cron in the first place, instead of drush cron ?

comment:3 in reply to:  2 Changed 7 years ago by Greg Lyle

Replying to https://id.mayfirst.org/dkg:

Given that all the MOSHes have drush installed, is there a reason we're using a wget-triggered cron in the first place, instead of drush cron ?

I'd use wget/curl instead of 'drush core-cron' when PHP is run as a different user than the user running 'drush cron-cron'. For example, when using Apache's mod_php, PHP is run as the webserver user. In that case, the files Drupal creates in /tmp can't be deleted by a different user running 'drush cron-cron'.

Since the MOSHes don't use mod_php, but run PHP as the same user who owns the files (and presumably as the same person running 'drush core-cron'), this should not be an issue for MOSHes.

Last edited 7 years ago by Greg Lyle (previous) (diff)

comment:4 in reply to:  2 Changed 7 years ago by Ross

Replying to https://id.mayfirst.org/dkg:

I can't find any documentation about keyed cron for drupal other than a plugin for drupal 6, which i don't think is what you're talking about. Was there a change someplace? Could you link to documentation?

I found it here http://drupal.org/node/23714

comment:5 Changed 7 years ago by Daniel Kahn Gillmor

After a bit of digging, i find that keyed cron also appears to also be documented in the INSTALL.txt file in core/.

gregl, i think that a "drush cron" cronjob set up when the "webapp" is created would be reasonable on a mosh, since we know which user account the web server will be running as, right? i can't tell whether comment:3 suggests that you think it will or won't work on MOSHes.

comment:6 in reply to:  5 Changed 7 years ago by Greg Lyle

Replying to https://id.mayfirst.org/dkg:

gregl, i think that a "drush cron" cronjob set up when the "webapp" is created would be reasonable on a mosh, since we know which user account the web server will be running as, right? i can't tell whether comment:3 suggests that you think it will or won't work on MOSHes.

I edited comment:3 to be more clear.

I was trying to give a reason *why* one might use wget, et.al. instead of using 'drush core-cron' in crontab, as well as *trying* to make it clear that reason doesn't apply to MOSHes.

comment:7 Changed 7 years ago by Ross

Keywords: f2f added

comment:8 Changed 7 years ago by Ross

Nat and Ross are going to handle this. Two phases:

  1. Get the new webap installation to apply drush cron
  1. Get the currently installed drupal 7 installs set up with drush cron

comment:9 Changed 7 years ago by Ross

Keywords: f2f removed

comment:10 Changed 7 years ago by Ross

Cc: nat@… added; support-team@… removed

Hi nat,

I just set up drush cron for servers.mayfirst.org using the following cron entry.

10 * * * * /usr/bin/drush --root=/home/members/mayfirst/sites/servers.mayfirst.org/web --uri=servers.mayfirst.org --quiet cron

do you think that's correct and how we should create D7(6) cron jobs for the web apps?

comment:11 Changed 7 years ago by Nat Meysenburg

That looks right to me.

As for the web apps, I think we know the root directory and uri of the site. Though I'm not convinced we know what the canonical domain is (if there even is one).

I've had pretty good luck just using the root directory. The situation where that doesn't work is while using Drupal multi-site functionality. Since our central install doesn't use multi-site, a site not being multi-site is the prerequisite for red knowing about it to begin with. So, I think we may be able to get away with not specifying the uri here.

--nat

comment:12 Changed 7 years ago by Ross

Resolution: fixed
Status: assignedfeedback

We have added the correct drush cron job to red. This should go live on red's next commit. It hasn't been tested yet, putting this ticket into feedback state in case something goes wrong.

comment:13 Changed 7 years ago by Ross

Resolution: fixed
Status: feedbackassigned

Reassigning this to jamie to remind him to push the changes to red.

comment:14 Changed 7 years ago by Ross

Owner: changed from Ross to Jamie McClelland

comment:15 Changed 7 years ago by Jamie McClelland

Changes are pushed - but I haven't signed them. Waiting til I get back to Austin (they are pushed on chavez and albizu).

jamie

Please login to add comments to this ticket.

Note: See TracTickets for help on using tickets.