![]() They are taken from the /proc/loadavg file. In addition to uptime, there were also three numbers that represent the load average. ![]() Whereas the number of seconds is more useful for using in your own programs or scripts. The uptime output is nicely formatted for humans So why do we need the uptime program if we can just read the contents of the file? It turns out that you can also use strace -e open uptime and not bother with grepping. Which contains the file /proc/uptime which I mentioned. Open( "/var/run/utmp", O_RDONLY|O_CLOEXEC) = 4 Our output is this: $ strace uptime 2>& 1 | grep open We can redirect the stderr to the standard output (stdout) stream with 2>&1. strace uptimeīut that will not really work since strace outputs everything to the standard error (stderr) stream. How did I know that? I looked at what files the uptime program opens when it is run. ![]() The second value may be greater than the overall system uptime on systems with multiple cores The second number is how much of that time the machine has spent idle, in seconds The first number is the total number of seconds the system has been up. It reads the information from the file /proc/uptime. You can see the same information by running uptime: $ uptimeġ2: 17: 58 up 111 days, 31 min, 1 user, load average: 0.00, 0.01, 0.05 Uptime shows how long the system has been running. /usr/lib/policykit-1/polkitd -no-debug./usr/lib/accountservice/accounts-daemon.t - stopped by debugger during the tracing.Z - defunct ("zombie") process, terminated but not reaped by its parent.S - interruptible sleep (waiting for an event to complete).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |