[olug] Uptime to boot date

Jon H. Larsen relayer at omahadirect.net
Tue Oct 29 18:46:48 UTC 2002


Cool...thanks!

Jon L.

On 29 Oct 2002, Quinn Coldiron wrote:

> Date: 29 Oct 2002 11:59:48 -0600
> From: Quinn Coldiron <qcoldir at nmhs.org>
> Reply-To: olug at olug.org
> To: olug at olug.org
> Subject: Re: [olug] Uptime to boot date
> 
> Perl to the rescue...
> 
> Boot date and time:
> 6/23/2001 09:21:09
> 
> 
> Here is the perl script:
> 
> #!/usr/bin/perl
> use Date::Calc qw(:all);
> 
> # put the values from the uptime command here:
> $Udays = 0 - 493;
> $Uhours = 0 - 2;
> $Usec= 0 - 41;
> 
> 
> ($Tyear,$Tmonth,$Tday, $Thour,$Tmin,$Tsec) = Today_and_Now();
> 
> ($year,$month,$day, $hour,$min,$sec) =
> Add_Delta_DHMS($Tyear,$Tmonth,$Tday, $Thour,$Tmin,$Tsec,
> $Udays,$Uhours,$Usec,"00");
> 
> $hour = sprintf("%02d",$hour);
> $min = sprintf("%02d",$min);
> $sec = sprintf("%02d",$sec);
> 
> print "$month/$day/$year $hour:$min:$sec\n";
> 
> 
> 
> 
> On Tue, 2002-10-29 at 11:42, Dave Hull wrote:
> > On Tue, 29 Oct 2002, Dave Hull wrote:
> > 
> > > Hm, not sure how to do that, but you could use this:
> > > 
> > > [~]$ last | grep -i boot
> > 
> > Come to think of it, this won't do you any good if you're logs are rotated out 
> > before your server is rebooted. If you've got /var/log/dmesg, you could check 
> > the date of that file to get a close approximation of the last boot time.
> > 
> > Good luck.
> > 
> > -- 
> > Dave Hull
> > http://insipid.com
> > 
> > He who despises himself nevertheless esteems himself as a self-despiser.
> > 		-- Friedrich Nietzsche
> > 
> > 
> > _______________________________________________
> > OLUG mailing list
> > OLUG at olug.org
> > http://lists.olug.org/mailman/listinfo/olug
> 

-- 
 [ Jon H. Larsen  - email: relayer at omahadirect dot net         ]
 [ ICQ#: 10412618 - http://www.animesunday.org/jonl               ]
 [ PGP Pubkey - http://www.animesunday.org/jonl/relayerpubkey.txt ]




More information about the OLUG mailing list