Class: InitExporter::Helpers::Init::SystemdBackend

Inherits:
BaseBackend
  • Object
show all
Defined in:
lib/init_exporter/helpers/init/systemd_backend.rb

Instance Method Summary collapse

Methods inherited from BaseBackend

#dry_run, #install, #uninstall

Constructor Details

#initialize(ssh) ⇒ SystemdBackend

Returns a new instance of SystemdBackend.



7
8
9
# File 'lib/init_exporter/helpers/init/systemd_backend.rb', line 7

def initialize(ssh)
  @ssh = ssh
end

Instance Method Details

#init_typeObject



11
12
13
# File 'lib/init_exporter/helpers/init/systemd_backend.rb', line 11

def init_type
  'systemd'
end

#running?(job_name) ⇒ Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/init_exporter/helpers/init/systemd_backend.rb', line 23

def running?(job_name)
  @ssh.test :sudo, 'systemctl', 'status', job_name
end

#start(job_name) ⇒ Object



15
16
17
# File 'lib/init_exporter/helpers/init/systemd_backend.rb', line 15

def start(job_name)
  @ssh.execute :sudo, 'systemctl', 'start', job_name
end

#stop(job_name) ⇒ Object



19
20
21
# File 'lib/init_exporter/helpers/init/systemd_backend.rb', line 19

def stop(job_name)
  @ssh.execute :sudo, 'systemctl', 'stop', job_name
end