Sha256: b55a88410e104f0ac20d9d0d16beb8f3505819347efc6d4ea003fcfae6f96762

Contents?: true

Size: 1.39 KB

Versions: 98

Compression:

Stored size: 1.39 KB

Contents

# frozen_string_literal: true

require 'avm/entries/jobs/base'
require 'avm/eac_ubuntu_base0/apache'
require 'eac_ruby_utils/core_ext'

module Avm
  module EacRailsBase1
    module Instances
      class SystemdUnit
        JOBS = %w[write_tasks_scheduler_command write_service link_service verify_service
                  reload_systemd enable_service start_service].freeze

        include ::Avm::Entries::Jobs::Base
        require_sub __FILE__, include_modules: true
        delegate :platform_instance, to: :instance

        enable_listable
        lists.add_symbol :option, :exec_run, :restart

        def description
          "#{instance.id} Tasks Scheduler"
        end

        def exec_run?
          options[OPTION_EXEC_RUN]
        end

        def option_list
          self.class.lists.option
        end

        def restart
          options[OPTION_RESTART]
        end

        def unit_name
          "#{instance.id}_tasks_scheduler.service"
        end

        def user
          instance.install_username
        end

        private

        def sudo_execute!(*args)
          platform_instance.host_env.command(['sudo'] + args).execute!
        end

        def sudo_system!(*args)
          command_args = ['sudo'] + args
          infom "Running \"#{::Shellwords.join(command_args)}\"..."
          platform_instance.host_env.command(command_args).system!
        end
      end
    end
  end
end

Version data entries

98 entries across 98 versions & 2 rubygems

Version Path
avm-eac_rails_base1-0.9.2 lib/avm/eac_rails_base1/instances/systemd_unit.rb
eac_tools-0.74.1 sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/systemd_unit.rb
eac_tools-0.74.0 sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/systemd_unit.rb
eac_tools-0.73.0 sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/systemd_unit.rb
eac_tools-0.72.0 sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/systemd_unit.rb
avm-eac_rails_base1-0.9.1 lib/avm/eac_rails_base1/instances/systemd_unit.rb
eac_tools-0.70.1 sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/systemd_unit.rb
avm-eac_rails_base1-0.9.0 lib/avm/eac_rails_base1/instances/systemd_unit.rb
eac_tools-0.70.0 sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/systemd_unit.rb
eac_tools-0.69.1 sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/systemd_unit.rb
eac_tools-0.69.0 sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/systemd_unit.rb
eac_tools-0.68.0 sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/systemd_unit.rb
eac_tools-0.67.1 sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/systemd_unit.rb
eac_tools-0.67.0 sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/systemd_unit.rb
eac_tools-0.66.0 sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/systemd_unit.rb
eac_tools-0.65.1 sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/systemd_unit.rb
eac_tools-0.65.0 sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/systemd_unit.rb
eac_tools-0.64.0 sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/systemd_unit.rb
eac_tools-0.63.0 sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/systemd_unit.rb
avm-eac_rails_base1-0.8.4 lib/avm/eac_rails_base1/instances/systemd_unit.rb