1

Problem

I can't get cron (specifically elysia cron) to run with Drush. I've been using this as a guide. What have I missed/done wrong?

My Crontab

PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
COLUMNS=80

*/5 * * * * /usr/bin/drush @main elysia-cron
* * * * * env > /tmp/cronenv.log

Checklist:

  • I've used www-data for my crontab. This is the default nginx server user.
  • The path to drush (/usr/bin/drush), comes from which drush.
  • I've used an alias for the site, @main. I've tested this outside of cron and the command drush @main elysia-cron runs cron, although only once an hour (see this problem). This cron runs every five minutes so it should work once an hour.

I also tried the format in the docs above:

*/5 * * * * /usr/bin/env PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin COLUMNS=80 /usr/bin/drush @main elysia-cron

4 Answers 4

3

It would probably be easier to use --root and --uri instead of @main. Drush loads aliases on a per-user basis; the user you are testing drush @main elysia-cron probably has the @main alias defined in an alias file in ~/.drush. You'd need to either move your aliases to a global location, or perhaps copy your alias file to the www-data user's .drush folder.

1
  • Cheers for third time in a row Greg, I did indeed have my alias file defined for a user who wasn't www-data, I'd completely forgotten I'd moved it from sites. Commented Dec 3, 2013 at 16:12
0

I copied my aliases drush folder from ~/.drush to /var/www the home of the default server user: www-data.

The command in Ubuntu I used was:

cp -r ~/.drush /var/www
0

Just make bash script /var/www/scripts/elysia_cron.sh

cd /var/www #put your path to the document root which add centext  
/usr/bin/drush elysia-cron

and start this script on cron

*/5 * * * * /var/www/scripts/elysia_cron.sh
0
drush --root=/var/your website/ elysia-cron
1
  • Hello and welcome. This may be an answer, but it does not explain why or how. Could you add some detail to it?
    – Mołot
    Commented Mar 20, 2014 at 14:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.