Difference between uptime and who -b

 
Thread Tools Search this Thread
Operating Systems Linux Red Hat Difference between uptime and who -b
# 1  
Old 07-23-2015
RedHat Difference between uptime and who -b

Hi Folks,

I have been checking on a redhat server for patching, when I tried the output for uptime and who -b both are not matching. I do not know the reason what happened and why it seems like this.

Please assist someone and explain in detail.
I would appreciate if I get the right answer.Smilie

Code:
[svcsuprt@miaapp003 ~]$ uptime
18:54:03 up 187 days, 23:07, 1 user, load average: 0.12, 0.04, 0.02

[svcsuprt@miaapp003 ~]$ who -b
system boot 2014-08-10 18:24

[svcsuprt@miaapp003 ~]$ last reboot
reboot system boot 2.6.32-504.el6.x Sun Aug 10 18:24 - 18:54 (347+00:29)
wtmp begins Sun Aug 10 18:24:50 2014

Moderator's Comments:
Mod Comment Please use CODE tags when displaying sample input, output, and code segments.

Last edited by Don Cragun; 07-23-2015 at 04:36 PM.. Reason: Add CODE tags
# 2  
Old 07-23-2015
Hello seenuvasan1985,

You can always refer man pages for options. Like as follows.
For uptime:
Quote:
UPTIME(1) Linux User’s Manual UPTIME(1)

NAME
uptime - Tell how long the system has been running.
For who -b:
Quote:
-b, --boot
time of last system boot
As above quotes, you can take one example who -b tells same like when a person(OS this case) born(came up) and uptime tells how old a person(OS this case, means what time it got rebooted last time) is. Just an silly and simple examples. Hope this helps you.


Thanks,
R. Singh
# 3  
Old 07-23-2015
Quote:
Originally Posted by RavinderSingh13
Hello seenuvasan1985,

You can always refer man pages for options. Like as follows.

... ... ...

As above quotes, you can take one example who -b tells same like when a person(OS this case) born(came up) and uptime tells how old a person(OS this case, means what time it got rebooted last time) is. Just an silly and simple examples. Hope this helps you.


Thanks,
R. Singh
That doesn't answer the question. On my system, the command line:
Code:
date;uptime;who -b

produced the output:
Code:
Thu Jul 23 12:19:26 PDT 2015
12:19  up 22 days, 12:22, 10 users, load averages: 1.08 1.06 1.09
reboot   ~        Jun 30 23:55

a few minutes ago. That shows a boot time reported by uptime about two minutes later than the time reported by who -b. I can blame that on the times being recorded at different phases in the boot process. I think seenuvasan1985 is asking why the timestamps on his system are ~6 months apart. Why did his system go down and come back up without rebooting?

Maybe someone took the system down to single user mode and then brought it back up to multi-user mode 187 days ago without rebooting???
# 4  
Old 07-23-2015
Thanks Don Cragun,

Actually my question is why i am getting different output.

Uptime shows the server is running since 187days and who -b says the last reboot happened at 2014-08-10 (340 days).

Usuallay both should match, what could happed here!!!
# 5  
Old 07-23-2015
Linux uptime command looks at file /proc/uptime and last reboot shows the reboot entry from /var/log/wtmp. The reboot entry is placed (I suppose) by init command and /proc/uptime shows uptime from the kernel's point of view - from starting the 1st CPU. Nobody knows your system better then you, but I would trust the output of uptime. wtmp file is easy to manipulate and it starts on the same date, as it shows last reboot. It may be, that last doesn't find any reboot entries at all and just reports the first entry of the file as last reboot time.
This User Gave Thanks to agent.kgb For This Post:
# 6  
Old 07-24-2015
Hi agent.kgb,

Thanks for your brief explanation. Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. War Stories

Once upon an uptime.

Hi All, Having recently started a new job, a Data Center Migration in fact I have been tasked with looking at some of the older Solaris boxes when I came across this little gem. nismas# uname -a SunOS nismas 5.5.1 Generic_103640-27 sun4u sparc SUNW,Ultra-1 nismas# uptime 10:37am up 2900... (2 Replies)
Discussion started by: gull04
2 Replies

2. Shell Programming and Scripting

Uptime script

How to write a shell script which can generate server uptime report from the UNIX servers? (3 Replies)
Discussion started by: paventhan
3 Replies

3. Shell Programming and Scripting

Extract the uptime from the output of the uptime command

Hi! I want to extract the uptime from the output of the uptime command. The output: 11:53 up 3:02, 2 users, load averages: 0,32 0,34 0,43 I just need the "3:02" part. How can I do this? Dirk (6 Replies)
Discussion started by: Dirk Einecke
6 Replies

4. UNIX for Dummies Questions & Answers

Difference between system uptime and last boot time.

My Linux system was last rebooted few hours ago. But it seems little confusing for me to figure out the exact reason behind it. I guess following command should justify what i meant to say. # date Wed May 11 13:22:49 IST 2011 # last | grep "May 10" reboot system boot 2.6.18-194.el5 ... (5 Replies)
Discussion started by: pinga123
5 Replies

5. UNIX for Advanced & Expert Users

We have uptime but is there a starttime?

Hi gurus, Is it possible to get the time on when the server was re-started or does the output from who -b is the answer to my question? UNIX flavour is Solaris. The uptime command gives information on how long the server has been up but I want to know when the server was started. The output... (4 Replies)
Discussion started by: newbie_01
4 Replies

6. Shell Programming and Scripting

Process Uptime

Hi, I need some help about a script i need to write. I want to check , if some specific process, are running since 2 hours. I tried to use a loop , grep my pid and use find -ctime on /proc directory, to list what i need. for i in `ps -ef |grep process |grep -v grep|awk '{print $2}'`... (2 Replies)
Discussion started by: rokerij
2 Replies

7. UNIX for Dummies Questions & Answers

Uptime

hello folks! how can I display just the uptime without the current time, the word "up", and the load averages using the uptime command or some other command I do not know about? (13 Replies)
Discussion started by: MastaFue
13 Replies

8. UNIX for Dummies Questions & Answers

uptime

On HP-UX, the 13th argument of uptime is sometime the load and sometime the word AVERAGE:??? 14 Jun 06 5:00pm up 44 days, 54 mins, 0 users, load average: 0.00, 0.02, 0.03 14 Jun 06 5:15pm up 44 days, 1:09, 0 users, load average: 0.00, 0.01, 0.01 When the time is in minutes, then the load... (1 Reply)
Discussion started by: qfwfq
1 Replies

9. UNIX for Dummies Questions & Answers

Getting uptime

I'm trying to get the uptime of my computer (Mac OS X) and I can go into the terminal and type "uptime" OK, and that gives me a string with the uptime in it. The problem is that the string changes a lot, and its very difficult to get the data I'm trying to extract out cleanly. Now I have 3... (2 Replies)
Discussion started by: Freefall
2 Replies

10. UNIX for Dummies Questions & Answers

uptime

Hi Folks uptime 12:24pm up 2 days, 3:12, 4 users, load average: 0.00, 0.00, 0.00 what does the load average figure mean.. regards Hrishy (2 Replies)
Discussion started by: xiamin
2 Replies
Login or Register to Ask a Question