Class: BackscriptsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
lib/generators/initializer/templates/backscript_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



5
6
7
# File 'lib/generators/initializer/templates/backscript_controller.rb', line 5

def index
   @backscripts = Backscript.all
end

#trigering_backscriptObject



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/generators/initializer/templates/backscript_controller.rb', line 9

def trigering_backscript
    back_script = Backscript.find(params[:backscript_id])
    command = back_script.command
    Open3.popen3(command) do |stdin, stdout, stderr, wait_thr| 
        @status = stdout.read.to_s
        back_script.status = "Solr is Running Successfully." if @status.include?("Dsolr.data.dir")
        back_script.status = "Sidekiq is Running Successfully." if @status.include?("grep sidekiq")
        back_script.save!
    end
    redirect_to :back    
end