Class: Daemon::Command::StopCommand
- Inherits:
-
BaseCommand
- Object
- BaseCommand
- Daemon::Command::StopCommand
- Defined in:
- lib/onapp/engine/command/stop_command.rb
Overview
Used to stop onapp-engine system service
Constant Summary
- TIMEOUT =
15- TIMEOUT_ERROR =
10- ERROR =
1- OK =
0
Instance Attribute Summary
Attributes inherited from BaseCommand
Attributes included from UserInterface
Instance Method Summary (collapse)
-
- (Object) execute
Entry point.
Methods inherited from BaseCommand
Methods included from UserInterface
Constructor Details
This class inherits a constructor from Daemon::Command::BaseCommand
Instance Method Details
- (Object) execute
Entry point
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/onapp/engine/command/stop_command.rb', line 18 def execute say 'Stopping OnApp Engine...' if .only_instances say 'Stopping OnApp Engine Workers...' master_pid = Daemon::MasterProcess.another_instance_pid if master_pid Process.kill(Daemon::MasterProcess::STOP_SIGNAL, master_pid) end return OK end if pids.count > 0 Daemon.force_stop.set if .forced say "#{pids.count} pids found: #{pids.join(', ')}" pids.each { |pid| terminate(pid) } if can_stop_immediately? return OK else say "#{Daemon::MasterProcess::PROCESS_NAME} (#{pids.join(', ')}) can't be stopped immediately" return TIMEOUT_ERROR end else say 'No running instances detected' return ERROR end end |