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
eac_tools-0.55.3 sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/systemd_unit.rb
eac_tools-0.55.2 sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/systemd_unit.rb
eac_tools-0.55.1 sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/systemd_unit.rb
eac_tools-0.55.0 sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/systemd_unit.rb
eac_tools-0.54.0 sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/systemd_unit.rb
eac_tools-0.53.0 sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/systemd_unit.rb
eac_tools-0.52.0 sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/systemd_unit.rb
eac_tools-0.51.0 sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/systemd_unit.rb
eac_tools-0.50.0 sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/systemd_unit.rb
eac_tools-0.49.0 sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/systemd_unit.rb
eac_tools-0.48.1 sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/systemd_unit.rb
avm-eac_rails_base1-0.8.0 lib/avm/eac_rails_base1/instances/systemd_unit.rb
eac_tools-0.48.0 sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/systemd_unit.rb
eac_tools-0.47.2 sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/systemd_unit.rb
eac_tools-0.47.1 sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/systemd_unit.rb
eac_tools-0.47.0 sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/systemd_unit.rb
avm-eac_rails_base1-0.7.1 lib/avm/eac_rails_base1/instances/systemd_unit.rb
eac_tools-0.46.0 sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/systemd_unit.rb
eac_tools-0.45.2 sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/systemd_unit.rb
eac_tools-0.45.1 sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/systemd_unit.rb