Sha256: b9ce60d4932f677a29b77e1c2bfe8a967cd575c6560c09f393fe17b397d0a94f
Contents?: true
Size: 1.79 KB
Versions: 98
Compression:
Stored size: 1.79 KB
Contents
# frozen_string_literal: true require 'eac_ruby_utils/core_ext' module Avm module EacRailsBase1 module Instances class SystemdUnit module Service def service_content template.child('tasks_scheduler.service').apply(variables_source) end def service_exec_lines service_exec_operations .map { |k, v| "#{k}=#{tasks_scheduler_command_path} #{v}" } .join("\n") end def service_path ::Pathname.new('/etc/systemd/system').join(unit_name) end def service_link_path ::Pathname.new('/etc/systemd/system/multi-user.target.wants').join(unit_name) end def verify_service sudo_system!('systemd-analyze', 'verify', service_path) end private def enable_service systemctl('enable', unit_name) end def link_service sudo_execute!('rm', '-f', service_link_path) sudo_execute!('ln', '-s', service_path, service_link_path) end def reload_systemd systemctl('daemon-reload') end # @return [Hash<String, String>] def service_exec_operations if exec_run? { 'ExecStart' => 'run' } else { 'ExecStart' => 'start', 'ExecStop' => 'stop' } end end def start_service systemctl('start', unit_name) end def systemctl(*args) sudo_system!('systemctl', *args) end def write_service infom 'Writing service\'s unit file...' platform_instance.file_sudo_write(service_path, service_content) end end end end end end
Version data entries
98 entries across 98 versions & 2 rubygems