Web Hosting Talk







View Full Version : Uptime script


PogiWeb
02-26-2004, 10:10 PM
I'm looking for a free script to show how long my server has been running....

nickn
02-26-2004, 10:17 PM
There's this great utility called "Uptime" from the command line.

Alternatively, if you are looking for a web interface, you could do phpsysinfo:

http://phpsysinfo.sourceforge.net/

Nymix-CB
02-26-2004, 10:17 PM
In SSH, just type "uptime".

If you want something a bit more "complex", do that in Perl:


#!/usr/bin/perl

chop($_ = `uptime`);
/(^.* up\s)(.*)(\s+\d*\suser.*)/;
my @time = split(/,/, $2);
for (@time) {
next unless($_);
s/min/minutes/;
s/days/days and /;
s/\s*(\d+):(\d\d)\s*/$1 hours/;
print;
}
exit;

brownstuff
02-26-2004, 10:52 PM
<?php system('uptime'); ?>

Uncle Mad
02-27-2004, 03:59 AM
Yes, phpsysinfo is great, i'm using it.