Method: Exekutor::Internal::CLI::Manager#stop

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

#stop(options) ⇒ Void

Stops a daemonized worker

Returns:

  • (Void)


47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/exekutor/internal/cli/manager.rb', line 47

def stop(options)
  daemon = Daemon.new(pidfile: pidfile)
  pid = daemon.pid
  if pid.nil?
    unless quiet?
      if options[:restart]
        puts "Executor was not running"
      else
        puts "Executor is not running (pidfile not found at #{daemon.pidfile})"
      end
    end
    return
  elsif daemon.status? :not_running, :dead
    return
  end

  Process.kill("INT", pid)
  wait_for_process_end(daemon, pid, shutdown_timeout(options))
  puts "Worker (PID: #{pid}) stopped." unless quiet?
end