Funny uptime behaviour
The command "uptime" is behaving rather strangely. My machine has been up for more than 50 days but uptime returns 7 days as result. I have one terminal window in which I regularly check the uptime and in the same terminal I have uptime results of 47 days and a few prompts later it says 7 days!
Strange. Any ideas? p.n |
try "last reboot" command to verify
some cleanup script may have deleted/arcived your utmp/wtmp files |
Indeed!
Code:
reboot system boot 2.4.21-99-defaul Sat Mar 19 11:52 (59+10:17) Regards |
uptime reads "/var/run/utmp"
did some cleanup job purge/archive /var/run/utmp ? |
try this:
cat /proc/uptime | perl -e ' $T=<>; $D = ($T / (3600 * 24)); $H = 24*($D - int($D)); $D=int($D); $H=int($H); print "Uptime: $D days $H hours\n";' |
mmmmm... before I do this, what is that I'll actually be doing?
|
# print what the kernel thinks about uptime (seconds since 1970)
cat /proc/uptime # format to days and hours perl -e "....." |
Well, the kernel says the same as 'uptime'. Uptime says 11 days and your command says 11 days. last reboot however reports the correct 61 days.
|
All times are GMT -5. The time now is 10:37 PM. |