#!/usr/bin/perl use POSIX; use IO::File; print( "Content-Type: text/html; charset=utf-8\r\n\r\n" ); my $full_output = "\n\n
\nStats |
---|
"; undef $ver; my $utime = IO::File->new( "/proc/uptime", "r" ) or die "Failed to open /proc/uptime"; my @tdata = split( m/ /, <$utime> ); my $thours = int($tdata[0]) / 60 / 60; my $tmins = int($tdata[1]) / 60 / 60; undef $utime; undef $tdata; $full_output .= "Uptime: ".int($thours)." hours ".int($tmins)." minutes "; undef $thours; undef $tmins; my $cpu = IO::File->new( "/proc/cpuinfo", "r" ) or die "Failed to open /proc/cpuinfo"; my $fline = ""; my @spl_speed = ""; my $ccount = 1; while ( $fline = <$cpu> ){ if ( $fline =~ m/cpu mhz/i ){ @spl_speed = split( m/: /, $fline ); $full_output .= "Core ".$ccount. " speed: ".$spl_speed[1]." MHz "; $ccount++; } } undef $cpu; undef $fline; undef $ccount; undef @spl_speed; my $minfo = IO::File->new( "/proc/meminfo", "r" ) or die "Failed to open /proc/meminfo"; my $minfoline = ""; while ( $minfoline = <$minfo> ){ $full_output .= $minfoline." "; } undef $minfoline; undef $minfo; $full_output .= " |