Class: AgentsControl::Service::Systemd

Inherits:
Service
  • Object
show all
Defined in:
lib/agents_control/service.rb

Overview

Linux.

Instance Method Summary collapse

Instance Method Details

#installObject



129
130
131
132
133
134
135
# File 'lib/agents_control/service.rb', line 129

def install
  write(path, unit)
  system("systemctl", "--user", "daemon-reload", out: File::NULL, err: File::NULL)
  system("systemctl", "--user", "enable", "--now", "agents-control",
         out: File::NULL, err: File::NULL)
  path
end

#installed?Boolean

Returns:

  • (Boolean)


143
# File 'lib/agents_control/service.rb', line 143

def installed? = File.exist?(path)

#log_pathObject



127
# File 'lib/agents_control/service.rb', line 127

def log_path = "journal"

#pathObject



125
# File 'lib/agents_control/service.rb', line 125

def path = File.expand_path("~/.config/systemd/user/agents-control.service")

#uninstallObject



137
138
139
140
141
# File 'lib/agents_control/service.rb', line 137

def uninstall
  system("systemctl", "--user", "disable", "--now", "agents-control",
         out: File::NULL, err: File::NULL)
  FileUtils.rm_f(path)
end