Module: CoreCronController

Includes:
CoreController
Defined in:
lib/app/controllers/concerns/core_cron_controller.rb

Overview

Manage cron job servers

Instance Method Summary collapse

Instance Method Details

#demoteObject

Demote a cron job server



43
44
45
46
47
48
49
50
# File 'lib/app/controllers/concerns/core_cron_controller.rb', line 43

def demote
  authorize! :edit, cron_server
  cron_server.become_secondary
  redirect_to index_path
rescue StandardError => error
  log_controller_error error, true
  redirect_to index_path
end

#destroyObject

Destroy a cron job server



55
56
57
58
59
60
61
62
# File 'lib/app/controllers/concerns/core_cron_controller.rb', line 55

def destroy
  authorize! :destroy, cron_server
  cron_server.destroy!
  redirect_to index_path
rescue StandardError => error
  log_controller_error error, true
  redirect_to index_path
end

#indexObject

Table to display cron job servers



11
12
13
14
# File 'lib/app/controllers/concerns/core_cron_controller.rb', line 11

def index
  authorize! :read, Cron::Server
  authorize! :read, Cron::Tab
end

#run_nowObject

Run the crontab entry now



19
20
21
22
23
24
25
26
# File 'lib/app/controllers/concerns/core_cron_controller.rb', line 19

def run_now
  authorize! :read, cron_tab
  cron_tab.run
  redirect_to index_path
rescue StandardError => error
  log_controller_error error, true
  redirect_to index_path
end

#updateObject

Update a crontab entry



31
32
33
34
35
36
37
38
# File 'lib/app/controllers/concerns/core_cron_controller.rb', line 31

def update
  authorize! :update, cron_tab
  cron_tab.update! cron_tab_params
  redirect_to index_path
rescue StandardError => error
  log_controller_error error
  render :edit
end