Skip to content
sourcecor edited this page Jul 15, 2016 · 3 revisions

Welcome to the jaybee wiki!

  1. Server端排程設定
    ※環境 = (capistrano部署 + whenever(0.97) + rake(job) )
    1. 工作定義
      使用rake,將副檔名(.rake)放置目錄(lib/tasks)
      example:
      `# /lib/tasks/job.rake`
      `namespace :daily do`
      `desc “Test Crontab”`
      `task :go => [:log]`
`# defined :log task` `task :log => :environment do` `Log.create(log:“Call from Task.”)` `end`

`end`
#測試 Task
`bundle exec rake daily:go`

  1. 排程定義
    #修改 config/schedule.rb
    `every 2.minutes do ## 每2分鐘執行一次`
    `rake ‘daily:go’`
    `end`
    #定義的方式參考 https://github.com/javan/whenever

Clone this wiki locally