1839808 Members
3646 Online
110156 Solutions
New Discussion

System uptime

 
Tim Giltinan
New Member

System uptime

Is there a way to view the system uptime in seconds or minutes instead of the default uptime output?
5 REPLIES 5
Roger Baptiste
Honored Contributor

Re: System uptime

hi,

i don't think there is any unix command to do that. It can be done through a script which parses uptime output and does the conversion.


-raj
Take it easy.
Bill McNAMARA_1
Honored Contributor

Re: System uptime

I believe the program nickel has a script function that does it.. (or something to that effect)

See http://www.grc.hp.com/docs/nickel/

Later,
Bill
It works for me (tm)
James Beamish-White
Trusted Contributor

Re: System uptime

Script expr statements with ifs.

e.g. to get mins
if [ `uptime | awk '{print $4}'` = "days," ]
then
echo `expr `uptime | awk '{print $3}'` \* 1440`
elsif
uptime | awk '{print $3}'
fi

Cheers,
James
GARDENOFEDEN> create light
James Beamish-White
Trusted Contributor

Re: System uptime

Sorry, that script didn't actually work when I tried it, this one does:

#!/bin/sh

if [ `uptime | awk '{print $4}'` = "days," ]
then
expr `uptime | awk '{print $3}'` \* 1440
else
uptime | awk '{print $3}'
fi


James
GARDENOFEDEN> create light
Victor BERRIDGE
Honored Contributor

Re: System uptime

Hi James,
You forgot to add the hours and minutes to your days_converted.to.minutes...


All the best

Victor