Class: Loops::Commands::StopCommand

Inherits:
Loops::Command show all
Defined in:
lib/loops/commands/stop_command.rb

Instance Attribute Summary

Attributes inherited from Loops::Command

#engine, #options

Instance Method Summary collapse

Methods inherited from Loops::Command

#initialize, #invoke

Constructor Details

This class inherits a constructor from Loops::Command

Instance Method Details

#executeObject



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/loops/commands/stop_command.rb', line 2

def execute
  STDOUT.sync = true
  raise "No pid file or a stale pid file!" unless Loops::Daemonize.check_pid(Loops.pid_file)
  pid = Loops::Daemonize.read_pid(Loops.pid_file)
  print "Killing the process: #{pid}: "

  loop do
    Process.kill('SIGTERM', pid)
    sleep(1)
    break unless Loops::Daemonize.check_pid(Loops.pid_file)
    print(".")
  end

  puts " Done!"
  exit(0)
end

#requires_bootstrap?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/loops/commands/stop_command.rb', line 19

def requires_bootstrap?
  false
end