#config/scheduler.rb
set :output, 'log/cron.log'
every 1.minutes do
rake 'reports:generate'
end
When I run crontab -l
I get the following output:
* * * * * /bin/bash -l -c 'cd <path-to-app> bundle exec rake reports:generate --silent >> log/cron.log 2>&1'
First off, it seems to use my system ruby
which is 1.8.7
, is there a way to change this?
Secondly, the task is not run, but the only thing that shows up in my cron.log
is the following:
Your Ruby version is 1.8.7, but your Gemfile specified 2.0.0
I've tried puts
to the log with no success, so I have basically no idea what's going on. It seems the task is being initiated, but then fails without anything being written to the log. I have no idea how to go about debugging this, so please help.
I'm on OS X, and my application is running on Sinatra.
edit: I'm using rbenv
to manage my ruby versions, so I guess I have to tell the cron job to load rbenv somehow? When I cd
into the app's folder and run ruby -v
I get
ruby 2.0.0p353 (2013-11-22 revision 43784) [x86_64-darwin12.5.0]