403Webshell
Server IP : 77.68.64.21  /  Your IP : 216.73.217.105
Web Server : Apache
System : Linux hp3-wp-1011378.hostingp3.local 3.10.0-1160.144.1.el7.tuxcare.els9.x86_64 #1 SMP Fri Jul 10 17:06:31 UTC 2026 x86_64
User : csh2668128 ( 2112425)
PHP Version : 8.1.34
Disable Function : shell_exec,exec,system,popen,set_time_limit
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/share/ruby/vendor_ruby/facter/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/share/ruby/vendor_ruby/facter/system_uptime.rb
# Fact: system_uptime
#
# Purpose:
#   Return the system uptime in a hash in the forms of
#   seconds, hours, days and a general, human
#   readable uptime.
#
#   This fact is structured. These values are returned as a group of key-value pairs.
#
# Resolution:
#   Does basic math on the get_uptime_seconds utility
#   to calculate seconds, hours and days.
#
# Caveats:
#

require 'facter/util/uptime'

Facter.add(:system_uptime) do
  setcode do
    system_uptime = {}
    if Facter.value(:kernel) == 'windows'
      seconds = Facter::Util::Uptime.get_uptime_seconds_win
    else
      seconds = Facter::Util::Uptime.get_uptime_seconds_unix
    end

    if seconds
      system_uptime['seconds'] = seconds
      minutes                  = seconds / 60 % 60
      system_uptime['hours']   = seconds / (60 * 60)
      system_uptime['days']    = system_uptime['hours'] / 24

      case system_uptime['days']
      when 0 then system_uptime['uptime'] = "#{system_uptime['hours']}:#{"%02d" % minutes} hours"
      when 1 then system_uptime['uptime'] = "1 day"
      else system_uptime['uptime']        = "#{system_uptime['days']} days"
      end
    else
      system_uptime['uptime']  = 'unknown'
    end
    system_uptime
  end
end

Youez - 2016 - github.com/yon3zu
LinuXploit