Sha256: 08f5c6260c13ce1ae8f40aff79d666d5b9ae8350ddd8d6355b903abb5d7d9e4d

Contents?: true

Size: 864 Bytes

Versions: 4

Compression:

Stored size: 864 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

4 entries across 4 versions & 1 rubygems

Version Path
bin_install-0.0.6 lib/bin_install/server.rb
bin_install-0.0.5 lib/bin_install/server.rb
bin_install-0.0.4 lib/bin_install/server.rb
bin_install-0.0.3 lib/bin_install/server.rb