The rake task seems never launched by Cron in a Ruby on Rails 5 application (Openproject 7)
openproject$ crontab -l
* * * * * cd /home/openproject/openproject-ce && RAILS_ENV=production bundle exec rake jobs:workoff >> log/cron.log
The log file is never created and the task is not performed (no debug info)....
What should I do ?
EDIT :
By running the rails console in the production environnement, I always have pending jobs :
Delayed::Job.count ==> 2
Running the same instruction with the same user (openproject) directly in the ssh console works successfully :
RAILS_ENV=production bundle exec rake jobs:workoff
==> returns successfully and Delayed::Job.count ==> 0
The cron daemon seems to be running :
sudo service cron status
cron.service - Regular background program processing daemon
Loaded: loaded (/lib/systemd/system/cron.service; enabled)
Active: active (running) since Sat 2017-07-15 16:03:13 CEST; 2 months 0 days ago
What do I miss ?
I found the solution thanks to a very good advice : the environnement variable are different for the cron and for a normal user (shell is not identical... obscure reason).
By adding directly in the cron th einstruction "source /home/username/.profile; " the problem was gone.
My .profile contains the adding of "rbenv" and "node" in the path, "rbenv init -" and same for node...