Class: GDK::Command::Stop

Inherits:
BaseCommand show all
Defined in:
lib/gdk/command/stop.rb

Overview

Start all enabled services or specified ones only

Instance Attribute Summary

Attributes inherited from BaseCommand

#stderr, #stdout

Instance Method Summary collapse

Methods inherited from BaseCommand

#config, #display_help_message, #help, #initialize, #print_help, #print_ready_message, #ready_messages, validate_config?

Constructor Details

This class inherits a constructor from GDK::Command::BaseCommand

Instance Method Details

#run(args = []) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/gdk/command/stop.rb', line 7

def run(args = [])
  GDK::Hooks.with_hooks(config.gdk.stop_hooks, 'gdk stop') do
    if args.empty?
      # Runit.stop will stop all services and stop Runit (runsvdir) itself.
      # This is only safe if all services are shut down; this is why we have
      # an integrated method for this.
      Runit.stop
    else
      # Stop the requested services, but leave Runit itself running.
      Runit.sv('force-stop', args)
    end
  end
end