Class: TyrantManager::Commands::Stop

Inherits:
TyrantManager::Command show all
Defined in:
lib/tyrant_manager/commands/stop.rb

Overview

Stop one or more tyrant instances

Instance Attribute Summary

Attributes inherited from TyrantManager::Command

#manager, #options

Instance Method Summary collapse

Methods inherited from TyrantManager::Command

#after, #before, #command_name, command_name, #error, find, inherited, #initialize, list, #logger

Constructor Details

This class inherits a constructor from TyrantManager::Command

Instance Method Details

#runObject



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/tyrant_manager/commands/stop.rb', line 8

def run
  manager.each_instance do |instance|
    ilist = options['instances']
    if ilist  == %w[ all ] or ilist.include?( instance.name ) then
      if File.exist?( instance.pid_file ) then
        logger.info "Stopping #{instance.name} : pid #{instance.pid}"
        instance.stop
      else
        logger.info "Stopping #{instance.name} : no pid file, nothing to do"
      end
    end
  end
end