Sha256: 397ae7abf13e9a8f935c10b4494bc3de2e3d13bbd6677d6cf57f4e4c4d55e532

Contents?: true

Size: 703 Bytes

Versions: 22

Compression:

Stored size: 703 Bytes

Contents

module Kuroko2
  module Command
    class Kill
      def initialize(host, process = nil)
        @hostname = host
        @process  = process
      end

      def execute
        if (signal = ProcessSignal.poll(@hostname))
          Kuroko2.logger.info("[#{@hostname}-#{@process}] Send #{Signal.signame(signal.number)} signal to #{signal.pid}")
          Process.kill(signal.number, signal.pid)

          signal.destroy!
          signal
        end
      rescue SystemCallError => e
        signal.update_column(:message, "[#{@hostname}-#{@process}] #{e.class}: #{e.message}") rescue nil

        Kuroko2.logger.error("[#{@hostname}-#{@process}] #{e.class}: #{e.message}")
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
kuroko2-0.8.0 lib/autoload/kuroko2/command/kill.rb
kuroko2-0.7.0 lib/autoload/kuroko2/command/kill.rb
kuroko2-0.6.0 lib/autoload/kuroko2/command/kill.rb
kuroko2-0.5.2 lib/autoload/kuroko2/command/kill.rb
kuroko2-0.5.1 lib/autoload/kuroko2/command/kill.rb
kuroko2-0.5.0 lib/autoload/kuroko2/command/kill.rb
kuroko2-0.4.6 lib/autoload/kuroko2/command/kill.rb
kuroko2-0.4.5 lib/autoload/kuroko2/command/kill.rb
kuroko2-0.4.4 lib/autoload/kuroko2/command/kill.rb
kuroko2-0.4.3 lib/autoload/kuroko2/command/kill.rb
kuroko2-0.4.2 lib/autoload/kuroko2/command/kill.rb
kuroko2-0.4.1 lib/autoload/kuroko2/command/kill.rb
kuroko2-0.4.0 lib/autoload/kuroko2/command/kill.rb
kuroko2-0.3.4 lib/autoload/kuroko2/command/kill.rb
kuroko2-0.3.3 lib/autoload/kuroko2/command/kill.rb
kuroko2-0.3.2 lib/autoload/kuroko2/command/kill.rb
kuroko2-0.3.1 lib/autoload/kuroko2/command/kill.rb
kuroko2-0.3.0 lib/autoload/kuroko2/command/kill.rb
kuroko2-0.2.3 lib/autoload/kuroko2/command/kill.rb
kuroko2-0.2.2 lib/autoload/kuroko2/command/kill.rb