Module: SwissAdmin::Commands

Defined in:
lib/swiss_admin/cli/web_cli.rb,
lib/swiss_admin/cli/host_cli.rb,
lib/swiss_admin/cli/user_cli.rb,
lib/swiss_admin/cli/network_cli.rb,
lib/swiss_admin/cli/hardware_cli.rb

Defined Under Namespace

Classes: Hardware, Host, Network, User, Web

Class Method Summary collapse

Class Method Details

.app_running?(pid) ⇒ Boolean

TODO:

move to another module Commands::Helpers??

Returns:

  • (Boolean)


6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/swiss_admin/cli/web_cli.rb', line 6

def self.app_running? pid
  pid = pid.to_i
  result = begin
             Process.kill(0, pid)
             :running
           rescue Errno::EPERM => e
             e.message
           rescue Errno::ESRCH => e
             :not_running
           rescue
             "Unable to determine status for #{pid} : #{$!}"
           end
  result
end