Sha256: 032d4a1debc3b475db11af840bdc99d79dd9454d3a1027ce2883168c121ff82d

Contents?: true

Size: 856 Bytes

Versions: 25

Compression:

Stored size: 856 Bytes

Contents

module BinInstall
  module Server
    def self.kill
      Dir.chdir(Dir.pwd) do
        pid_file = 'tmp/pids/server.pid'
        puts 'Server is not running!'.yellow unless File.exist?(pid_file)

        server_pid = `cat tmp/pids/server.pid`

        if system("kill -9 #{server_pid}")
          puts "PID #{server_pid} killed.".green
        else
          puts "PID #{server_pid} can not be killed!".red
        end
      end
    end

    def self.kill!
      Dir.chdir(Dir.pwd) do
        pid_file = 'tmp/pids/server.pid'
        abort('Server is not running!'.yellow) unless File.exist?(pid_file)

        server_pid = `cat tmp/pids/server.pid`

        if system("kill -9 #{server_pid}")
          puts "PID #{server_pid} killed.".green
        else
          abort("PID #{server_pid} can not be killed!".red)
        end
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
bin_install-0.0.13 lib/bin_install/server.rb
bin_install-0.0.12 lib/bin_install/server.rb
bin_install-0.0.11 lib/bin_install/server.rb
bin_install-0.0.10 lib/bin_install/server.rb
bin_install-0.0.9 lib/bin_install/server.rb