Class: Wheneverd::CLI::Deactivate

Inherits:
Wheneverd::CLI show all
Defined in:
lib/wheneverd/cli/deactivate.rb

Overview

Implements wheneverd deactivate (stop + disable timers/services via systemctl --user).

Instance Method Summary collapse

Methods inherited from Wheneverd::CLI

#handle_error, #identifier_value, #load_schedule

Instance Method Details

#executeObject



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/wheneverd/cli/deactivate.rb', line 6

def execute
  units = activatable_unit_basenames
  return 0 if units.empty?

  Wheneverd::Systemd::Systemctl.run("stop", *units)
  Wheneverd::Systemd::Systemctl.run("disable", *units)

  units.each { |unit| puts unit }
  0
rescue StandardError => e
  handle_error(e)
end