All pastes #796697 Raw Edit

Stuff

public php v1 · immutable
#796697 ·published 2007-11-25 09:03 UTC
rendered paste body
function sysinfo()    {        $kernel = shell_exec("uname -r") . substr("\n", 0, -2);        $host = shell_exec("hostname");        $hostname = shell_exec("hostname -f");        $uptime = shell_exec("uptime");        $cpuvendor = shell_exec("cat /proc/cpuinfo | head -n2 | tail -n1 | cut -f2 -d: | sed 's| ||'");        $cpumodel = shell_exec("cat /proc/cpuinfo | head -n5 | tail -n1 | cut -f2 -d: | sed 's| ||'");        $cpumhz = shell_exec("cat /proc/cpuinfo | head -n7 | tail -n1 | cut -f2 -d: | sed 's| ||'");        $cpucache = shell_exec("cat /proc/cpuinfo | head -n8 | tail -n1 | cut -f2 -d: | sed 's| ||'");        $memtotal = shell_exec("free -m | head -n2 | tail -n1 | awk '{ print $2 }'");        $memused = shell_exec("free -m | head -n3 | tail -n1 | awk '{ print $3 }'");        $memfree = shell_exec("free -m | head -n3 | tail -n1 | awk '{ print $4 }'");        $mempused = $memused / $memtotal * 100;        $mempused = substr("$mempused", 0, -11);        $mempfree = $memfree / $memtotal * 100;        $mempfree = substr("$mempfree", 0, -11);        $order = array("\r\n", "\n", "\r", "\t");        $output = str_replace($order, "", 'Host: ' . chr(2) . $host . chr(2) . ' Running: ' .            chr(2) . $kernel . chr(2) . ' Uptime:' . chr(2) . $uptime . chr(2) .            ' | Sysinfo: ' . $cpuvendor . ' ' . $cpumodel . ' running at ' . chr(2) . $cpumhz .            chr(2) . " MHz " . chr(2) . $cpucache . chr(2) .            ' cache | Meminfo: Total Memory: ' . chr(2) . $memtotal . 'mb' . chr(2) .            ' Used: ' . chr(2) . $memused . 'mb ' . chr(2) . "($mempused%)" . ' Free: ' .            chr(2) . $memfree . 'mb ' . chr(2) . "($mempfree%)");            return trim($output);    }