LoginSignup
0
0

More than 1 year has passed since last update.

wheneverにおいてのcron設定

Posted at

環境

Ruby 3.0.2
Rails 6.1.4.1
Docker version 20.10.7
docker-compose version 1.29.2

cronとは

多くのUNIX系OSで標準的に利用される常駐プログラム(デーモン)の一種で、利用者の設定したスケジュールに従って指定されたプログラムを定期的に起動してくれるもの。

cronの設定

  • wheneverをインストールしてあることを確認して下記の設定
  • cronはコマンド'分 時 日 月 曜日'で設定
  • 「月曜〜金曜の19時」に実行したい
config/schedule.rb
...
every '0 19 * * mon-fri' do
  rake 'namespace名:task名'
end

設定内容を確認

% docker-compose exec app bundle exec whenever

cronにデータを反映

% docker-compose exec app bundle exec whenever --update-crontab

実際のcrontabファイルを確認

 % docker-compose exec app bundle exec crontab -l          

参考

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0