Class: Wheneverd::CLI::Activate

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

Overview

Implements wheneverd activate (enable + start 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/activate.rb', line 6

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

  Wheneverd::Systemd::Systemctl.run("daemon-reload")
  Wheneverd::Systemd::Systemctl.run("enable", "--now", *units)

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