Re: How can I tell if my machine has rebooted?



On 2008-05-28 09:20, Johan Lindquist wrote:
So anyway, it was like, 18:37 CEST May 27 2008, you know? Oh, and, yeah,
J.O. Aho was all like, "Dude,

[..]

Otherwise you can use:

last | grep reboot | head

Useless use of grep? 'last reboot | head' :)

When using 'last', one has to take into account whether logrotate is
being run from cron too, since then you'll only see the logins and
reboots since last time the lastlog was rotated out.

I'd suggest installing uptimed for those interesting uptime and reboot
statistics.


The problem you describe is due to an insane way to prune wtmp that most
systems use, where they just null wtmp.

The correct way to prune wtmp is to copy utmp to wtmp.
Then your last reboot, level changes and all current sessions are preserved.

One can also do
vi rebooted

leave the editor open, and if the machine crash, one get a mail saying
that the edito buffert rebooted was saved at <date> when the system crashed :-)


/bb
.



Relevant Pages

  • Re: Who output error
    ... >killing the ksh process doesn't help ... followed by a reboot, is sufficient. ... make sure you are using the AIX 5 version of sshd. ... login-like programs that record activity in wtmp. ...
    (comp.unix.aix)
  • Re: How can I tell if my machine has rebooted?
    ... 'last reboot | head':) ... Linux 2.6.23.12 x86_64 GNU/Linux Registered Linux user #261729 ...
    (alt.os.linux)
  • Re: Find time of last boot
    ... I need to find the time of the last boot in a shell script. ... parse the output from last ... The pseudo user reboot logs in each time the system is ... wtmp begins Sun Mar 25 10:18:28 2007 ...
    (comp.os.linux.misc)
  • date command and WTMP file.
    ... I read the man pages of WTMP viz man wtmp and I find the ... the terminal name ~ with user name shutdown or reboot ... indicates a system shutdown or reboot and the ... not being updated in the WTMP file. ...
    (linux.redhat)
  • utmp and wtmp, not updating
    ... wtmp and utmp stop working after a few minutes after a reboot. ... I have compared permissions and such to a working 5.1a system. ...
    (Tru64-UNIX-Managers)