Method: Exekutor::Internal::CLI::Daemon#status

Defined in:
lib/exekutor/internal/cli/daemon.rb

#status:running, ...

The process status for this daemon. Possible states are:

  • :running when the daemon is running;

  • :not_running when the daemon is not running;

  • :dead when the daemon is dead. (Ie. the PID is known, but the process is gone);

  • :not_owned when the daemon cannot be accessed.

Returns:

  • (:running, :not_running, :dead, :not_owned)

    the status



45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/exekutor/internal/cli/daemon.rb', line 45

def status
  pid = self.pid
  return :not_running if pid.nil?

  # If sig is 0, then no signal is sent, but error checking is still performed; this can be used to check for
  # the existence of a process ID or process group ID.
  ::Process.kill(0, pid)
  :running
rescue Errno::ESRCH
  :dead
rescue Errno::EPERM
  :not_owned
end