[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [cobalt-users] OT: Showing uptime via web



>> I want to show the number of days my RaQ3 has been up for in a Perl Cgi
>> script. I found a script to call the following up:
>> 6:58pm  up 43 days,  3:38,  1 user,  load average: 0.05, 0.05, 0.05



> Since the output of 'uptime' is going to always be of the same format you
can
> use regular expressions to pull out what you need.




uptime won't always be the same format.  It is different when your box has
been up for less than one day; however I agree regular expressions in perl
or awk would be the easiest.  For the most reliable results, parse the
figures in /proc/uptime.

--Stew Smith
Cobalt Networks