###前提・実現したいこと
Wheneverでcronを自動設定したいです。
アドバイスをお願いします。
- 実行したいメソッド
━━━━━━━━━━━━━━━━━━━━━━━━━━━━
model/crawler.rb に記述
class Crawler
def self.movie_urls
puts 'hoge'
end
━━━━━━━━━━━━━━━━━━━━━━━━━━━━
- schedule.rbファイルで呼び出したい処理を記述
━━━━━━━━━━━━━━━━━━━━━━━━━━━━
set :output, 'log/cron.log'
every 1.minute do
runner "Crawler.movie_urls"
━━━━━━━━━━━━━━━━━━━━━━━━━━━━
- bundle exec whenever --update-crontabで設定
###発生している問題・エラーメッセージ
rails runner Crawler.movie_urls を実行してもエラーがでてません。Wheneverに登録すると以下のエラーが出てします。
また呼び出したメソッドはputs 'hoge'なのになぜcontrollerのエラー出るのかわかりません。
Users/todamasato/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:457:in `load': /Users/todamasato/projects/GameSiteAPI/app/controllers/api/products_controller.rb:7: syntax error, unexpected end-of-input, expecting keyword_end
end
^ (SyntaxError)
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。