From dd65d973261cab983214fa1e6b7ac645011c3603 Mon Sep 17 00:00:00 2001 From: gabimartini Date: Tue, 16 Jul 2024 15:01:16 +0100 Subject: [PATCH] add whenever and schedule command --- Gemfile | 1 + Gemfile.lock | 4 ++++ config/schedule.rb | 24 ++++++++++++++++++++++++ 3 files changed, 29 insertions(+) create mode 100644 config/schedule.rb diff --git a/Gemfile b/Gemfile index 14f6a813..c64970e3 100644 --- a/Gemfile +++ b/Gemfile @@ -12,6 +12,7 @@ gem 'turbolinks', '~> 5' gem 'jbuilder', '~> 2.7' gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] gem 'bootsnap', '>= 1.4.2', require: false +gem 'whenever', require: false gem 'kaminari' gem 'devise' diff --git a/Gemfile.lock b/Gemfile.lock index 6e5b0583..735fb003 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -87,6 +87,7 @@ GEM xpath (~> 3.2) case_transform (0.2) activesupport + chronic (0.10.2) closure_tree (7.4.0) activerecord (>= 4.2.10) with_advisory_lock (>= 4.0.0) @@ -416,6 +417,8 @@ GEM websocket-driver (0.7.3) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) + whenever (1.0.0) + chronic (>= 0.6.3) with_advisory_lock (4.6.0) activerecord (>= 4.2) xpath (3.2.0) @@ -480,6 +483,7 @@ DEPENDENCIES uk_postcode web-console (>= 3.3.0) webpacker (~> 5.0) + whenever RUBY VERSION ruby 3.0.3p157 diff --git a/config/schedule.rb b/config/schedule.rb new file mode 100644 index 00000000..cdbf195f --- /dev/null +++ b/config/schedule.rb @@ -0,0 +1,24 @@ +# Use this file to easily define all of your cron jobs. +# +# It's helpful, but not entirely necessary to understand cron before proceeding. +# http://en.wikipedia.org/wiki/Cron + +# Example: +# +# set :output, "/path/to/my/cron_log.log" +# +# every 2.hours do +# command "/usr/bin/some_great_command" +# runner "MyModel.some_method" +# rake "some:great:rake:task" +# end +# +# every 4.days do +# runner "AnotherModel.prune_old_records" +# end + +every 5.minute do + command "docker compose exec outpost bin/rails build_public_index " +end + +# Learn more: http://github.com/javan/whenever