Class: Yast::SystemdServiceClass::Service

Inherits:
Yast::SystemdUnit show all
Includes:
Logger
Defined in:
library/systemd/src/modules/systemd_service.rb

Constant Summary collapse

START_SERVICE_INSTSYS_COMMAND =

Available only on installation system

"/bin/service_start".freeze

Constants inherited from Yast::SystemdUnit

Yast::SystemdUnit::ACTIVE_STATES, Yast::SystemdUnit::DEFAULT_PROPMAP, Yast::SystemdUnit::SUPPORTED_STATES, Yast::SystemdUnit::SUPPORTED_TYPES

Instance Attribute Summary

Attributes inherited from Yast::SystemdUnit

#error, #name, #properties, #propmap, #unit_name, #unit_type

Instance Method Summary collapse

Methods inherited from Yast::SystemdUnit

#command, #disable, #enable, #initialize, #refresh!, #reload, #reload_or_restart, #reload_or_try_restart, #show, #status, #try_restart

Constructor Details

This class inherits a constructor from Yast::SystemdUnit

Instance Method Details

#pidString

Returns:



143
144
145
# File 'library/systemd/src/modules/systemd_service.rb', line 143

def pid
  properties.pid
end

#restartObject



161
162
163
164
165
166
167
168
# File 'library/systemd/src/modules/systemd_service.rb', line 161

def restart
  # Delegate to SystemdUnit#restart if not within installation
  return super unless installation_system?

  stop
  sleep(1)
  start
end

#running?Boolean

Returns:

  • (Boolean)


147
148
149
# File 'library/systemd/src/modules/systemd_service.rb', line 147

def running?
  properties.running?
end

#startObject



151
152
153
154
# File 'library/systemd/src/modules/systemd_service.rb', line 151

def start
  command = "#{START_SERVICE_INSTSYS_COMMAND} #{unit_name}"
  installation_system? ? run_instsys_command(command) : super
end

#stopObject



156
157
158
159
# File 'library/systemd/src/modules/systemd_service.rb', line 156

def stop
  command = "#{START_SERVICE_INSTSYS_COMMAND} --stop #{unit_name}"
  installation_system? ? run_instsys_command(command) : super
end