1748156 Members
4029 Online
108758 Solutions
New Discussion юеВ

Re: RedHat boot Question

 
frederick hannah
Super Advisor

RedHat boot Question

I have a Linux platform (Red Hat Enterprise Linux AS release 4 (Nahant Update 4) and I want to get a history of its reboots/shutdown. How can I get this information?
7 REPLIES 7
Ivan Ferreira
Honored Contributor

Re: RedHat boot Question

You can use the command:

last -x
last reboot
last shutdown
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
James Brand
Frequent Advisor

Re: RedHat boot Question

Here's a handy Perl script you can use -

#!/usr/bin/perl

my $input = "/proc/uptime";
open (INPUT, "$input") || die "Can't open file $input : $!\n";
while () {
($secsago) = (split(/\s+/))[0];
}
$boottime = time() - $secsago;
$bootdate = localtime($boottime);
print "$bootdate\n";
frederick hannah
Super Advisor

Re: RedHat boot Question

What i am looking for is a complete history of shutdowns/reboots for this server. Is there a log file with that information available?
Steven E. Protter
Exalted Contributor

Re: RedHat boot Question

Shalom,

No, there is not a complete history available.

Here is why.

AS 4.4 ships with logrotate configured to run. It archieves /var/log/messages and keeps 4 copies, so the farthest you go back is 5 weeks.

Now if your system has been altered, you may have more information, but by default you get 5 weeks.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
frederick hannah
Super Advisor

Re: RedHat boot Question

Not exactly what I wanted to hear Steve, but that explains a lot. thanks for everyone's iput.
frederick hannah
Super Advisor

Re: RedHat boot Question

Sorry I forgot to assign points to everyone as I value the quick and accurate responses
frederick hannah
Super Advisor

Re: RedHat boot Question

Solution found