[olug] Uptime to boot date

David Walker linux_user at grax.com
Tue Oct 29 19:26:06 UTC 2002


Here is a tcl script


#!/usr/bin/tclsh

set proc_uptime [exec cat /proc/uptime]
set uptime [string range $proc_uptime 0 [string first {.} $proc_uptime]]

set boot_date [expr int([clock seconds] - $uptime)]

puts [clock format $boot_date]


On Tuesday 29 October 2002 11:27 am, (Via wrote:
> Anyone know a quick way how I can turn the uptime output into an actual
> date/time of the last boot?  Would it be the date command?
>
> [~]$ uptime
>  11:25am  up 493 days,  2:41
>
> Jon L.




More information about the OLUG mailing list