Skip to content

Instantly share code, notes, and snippets.

@mdesantis
Last active May 28, 2023 16:11
Show Gist options
  • Select an option

  • Save mdesantis/5356195 to your computer and use it in GitHub Desktop.

Select an option

Save mdesantis/5356195 to your computer and use it in GitHub Desktop.
Schedule script for using Whenever toghether with rbenv
# Schedule script for using Whenever toghether with rbenv
#
# Whenever: https://github.com/javan/whenever
# rbenv: https://github.com/sstephenson/rbenv
set :env_path, '"$HOME/.rbenv/shims":"$HOME/.rbenv/bin"'
# doesn't need modifications
# job_type :command, ":task :output"
job_type :rake, %q{ cd :path && PATH=:env_path:"$PATH" RAILS_ENV=:environment bin/rake :task --silent :output }
job_type :runner, %q{ cd :path && PATH=:env_path:"$PATH" bin/rails runner -e :environment ':task' :output }
job_type :script, %q{ cd :path && PATH=:env_path:"$PATH" RAILS_ENV=:environment bundle exec bin/:task :output }
# tasks
every 1.day, :at => Time.now + 1.minute do
rake "my:task"
runner "puts 'hello from runner'"
script 'hello'
end
@juansecaro
Copy link
Copy Markdown

With this I get the runner working but not rake
"rake aborted!
Don't know how to build task"

@jjy05
Copy link
Copy Markdown

jjy05 commented Jul 14, 2021

It works for me!!!Thanks!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment