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.33 lib/bin_install/server.rb
bin_install-0.0.32 lib/bin_install/server.rb
bin_install-0.0.31 lib/bin_install/server.rb
bin_install-0.0.30 lib/bin_install/server.rb
bin_install-0.0.29 lib/bin_install/server.rb
bin_install-0.0.28 lib/bin_install/server.rb
bin_install-0.0.27 lib/bin_install/server.rb
bin_install-0.0.26 lib/bin_install/server.rb
bin_install-0.0.25 lib/bin_install/server.rb
bin_install-0.0.24 lib/bin_install/server.rb
bin_install-0.0.23 lib/bin_install/server.rb
bin_install-0.0.22 lib/bin_install/server.rb
bin_install-0.0.21 lib/bin_install/server.rb
bin_install-0.0.20 lib/bin_install/server.rb
bin_install-0.0.19 lib/bin_install/server.rb
bin_install-0.0.18 lib/bin_install/server.rb
bin_install-0.0.17 lib/bin_install/server.rb
bin_install-0.0.16 lib/bin_install/server.rb
bin_install-0.0.15 lib/bin_install/server.rb
bin_install-0.0.14 lib/bin_install/server.rb