ruby on rails - How to run a rake task regularly with using CRON? -



ruby on rails - How to run a rake task regularly with using CRON? -

i've written rake task rails application , i'd need run tasks regularly using cron.

if have url need ping cron, this:

0 */6 * * * curl https://www.website.com/something

but how "ping" rake task?

the application located in /home/deployer/apps/myapp-production/current , running on digitaloceal (ubuntu server - nginx).

thanks.

edit: command:

0 */6 * * * cd /home/deployer/apps/myapp-production/current && rails_env=production bundle exec rake db:backup

but output is:

/bin/sh: 1: bundle: not found

when run rake db:backup on laptop (locally), works well.

do have wrong path in cron task?

edit2: when run command cd /home/deployer/apps/myapp-production/current && rails_env=production bundle exec rake db:backup manually command line, working, not cron.

use whenever gem. provides nice dsl like:

every :day, :at => '12:20am', :roles => [:app] rake "app_server:task" end

ruby-on-rails ruby cron rake rake-task

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -