Class: ThinService::Command::Commands::Remove

Inherits:
Base
  • Object
show all
Includes:
ServiceValidation
Defined in:
lib/thin_service/command.rb

Instance Attribute Summary

Attributes inherited from Base

#done_validating, #valid

Instance Method Summary collapse

Methods included from ServiceValidation

#configure, #validate

Methods inherited from Base

#configure, #failure, #help, #initialize, #options, #valid?, #valid_dir?, #valid_exists?, #valid_file?, #validate

Constructor Details

This class inherits a constructor from ThinService::Command::Base

Instance Method Details

#runObject



331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
# File 'lib/thin_service/command.rb', line 331

def run
  display_name = ServiceManager.getdisplayname(@svc_name)

  begin
    puts "Stopping #{display_name} if running..."
    ServiceManager.stop(@svc_name)
  rescue ServiceManager::ServiceError => e
  end

  begin
    ServiceManager.delete(@svc_name)
  rescue ServiceManager::ServiceError => e
    puts e
  end

  unless ServiceManager.exist?(@svc_name) then
    puts "#{display_name} service removed."
  end
end