HEX
Server: Apache
System: Linux dinesh8189 5.15.98-grsec-sharedvalley-2.lc.el8.x86_64 #1 SMP Thu Mar 9 09:07:30 -03 2023 x86_64
User: cgmgerenciamento1 (814285)
PHP: 8.1.26
Disabled: apache_child_terminate,dl,escapeshellarg,escapeshellcmd,exec,link,mail,openlog,passthru,pcntl_alarm,pcntl_exec,pcntl_fork,pcntl_get_last_error,pcntl_getpriority,pcntl_setpriority,pcntl_signal,pcntl_signal_dispatch,pcntl_sigprocmask,pcntl_sigtimedwait,pcntl_sigwaitinfo,pcntl_strerror,pcntl_wait,pcntl_waitpid,pcntl_wexitstatus,pcntl_wifexited,pcntl_wifsignaled,pcntl_wifstopped,pcntl_wstopsig,pcntl_wtermsig,php_check_syntax,php_strip_whitespace,popen,proc_close,proc_open,shell_exec,symlink,system
Upload Files
File: //opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/provider/service/openrc.rb
# Gentoo OpenRC
Puppet::Type.type(:service).provide :openrc, :parent => :base do
  desc <<-EOT
    Support for Gentoo's OpenRC initskripts

    Uses rc-update, rc-status and rc-service to manage services.

  EOT

  defaultfor :operatingsystem => :gentoo
  defaultfor :operatingsystem => :funtoo

  has_command(:rcstatus, '/bin/rc-status') do
    environment :RC_SVCNAME => nil
  end
  commands :rcservice => '/sbin/rc-service'
  commands :rcupdate  => '/sbin/rc-update'

  self::STATUSLINE = /^\s+(.*?)\s*\[\s*(.*)\s*\]$/

  def enable
    rcupdate('-C', :add, @resource[:name])
  end

  def disable
    rcupdate('-C', :del, @resource[:name])
  end

  # rc-status -a shows all runlevels and dynamic runlevels which
  # are not considered as enabled. We have to find out under which
  # runlevel our service is listed
  def enabled?
    enabled = :false
    rcstatus('-C', '-a').each_line do |line|
      case line.chomp
      when /^Runlevel: /
        enabled = :true
      when /^\S+/ # caption of a dynamic runlevel
        enabled = :false
      when self.class::STATUSLINE
        return enabled if @resource[:name] == $1
      end
    end
    :false
  end

  def self.instances
    instances = []
    rcservice('-C', '--list').each_line do |line|
      instances << new(:name => line.chomp)
    end
    instances
  end

  def restartcmd
    (@resource[:hasrestart] == :true) && [command(:rcservice), @resource[:name], :restart]
  end

  def startcmd
    [command(:rcservice), @resource[:name], :start ]
  end

  def stopcmd
    [command(:rcservice), @resource[:name], :stop]
  end

  def statuscmd
    ((@resource.provider.get(:hasstatus) == true) || (@resource[:hasstatus] == :true)) && [command(:rcservice), @resource[:name], :status]
  end

end