Rickard wrote:You can have a look at the code in admin_index.php that shows the load.
Thanks Rickard, I did peek at it, slightly different as this one seems to check for Win OS
Frank: I double checked and made two quick files:
http://www.phpmywebthing.com/addons/temp/sload.php
which runs ita couple ways- see text...
-----------------------------------------------------------------
and this one:
http://www.phpmywebthing.com/addons/temp/sload_raw.php
which is only the following code:
<?php
if(PHP_OS != 'WINNT' && PHP_OS != 'WIN32') {
if(file_exists('/proc/loadavg') ) {
if ($fh = @fopen( '/proc/loadavg', 'r' )) {
$data = @fread( $fh, 6 );
@fclose( $fh );
$load_avg = explode( " ", $data );
$server_load = trim($load_avg[0]);
}
} else {
$data = @system('uptime');
preg_match('/(.*):{1}(.*)/', $data, $matches);
$load_arr = explode(',', $matches[2]);
$server_load = trim($load_arr[0]);
}
}
if(!$server_load) {
$server_load = 'N/A';
}
?>
and it is printing out the line. It is running the else branch.
-------------------------------------------------------------------------
OK- figured it out, it is the @system function (or @passthru if used) that is outputing the string. RTFM I guess http://us3.php.net/manual/en/function.system.php
Change to @exec and is fine...
Which is what Rickard has
Thanks all....