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