Module: BinInstall::Server

Defined in:
lib/bin_install/server.rb

Class Method Summary collapse

Class Method Details

.killObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/bin_install/server.rb', line 3

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

.kill!Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/bin_install/server.rb', line 18

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