Class: TTCluster::StopCommand
- Inherits:
-
BaseCommand
- Object
- BaseCommand
- TTCluster::StopCommand
- Defined in:
- lib/ttcluster/stop_command.rb
Overview
‘stop’ command implementation.
Instance Method Summary collapse
-
#initialize(runner, port) ⇒ StopCommand
constructor
Save runner and port for ‘stop’ run.
-
#run ⇒ Object
Stop ttcluster server.
Constructor Details
#initialize(runner, port) ⇒ StopCommand
Save runner and port for ‘stop’ run.
17 18 19 20 |
# File 'lib/ttcluster/stop_command.rb', line 17 def initialize(runner, port) super(runner) @port = port end |
Instance Method Details
#run ⇒ Object
Stop ttcluster server.
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/ttcluster/stop_command.rb', line 24 def run chdir_to_ttbase statuses = get_statuses(@port) puts "TTCluster Stop:" statuses.each do |port, status| msg = case status when /^(running|mismatch) pid\((\d+)\)/ (stop_server($2.to_i) ? MSG_STOPPED_SERVER : MSG_FAILED_TO_STOP_SERVER) % $2 when /^not running/ MSG_SERVER_NOT_RUNNING when /^stale pid\((\d+)\)/ remove_pid_file(port) MSG_STALE_PID % $1 end puts " port(#{port}) => #{msg}" end end |