[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cobalt-developers] raq4 memory problem... in php



On Tue, Aug 20, 2002 at 03:40:08PM +0200, ToPPi mentioned:
> it would be nice to run this in a php script..
> has anyone of you an idea how to run the commands below in an php script and
> show the result there?
> 
> > #!/bin/sh
> > physical=`grep Mem: /proc/meminfo  | awk '{print $2}'`
> > used=`grep Mem: /proc/meminfo  | awk '{print $3}'`
> > buffers=`grep Mem: /proc/meminfo  | awk '{print $6}'`
> > cache=`grep Mem: /proc/meminfo  | awk '{print $7}'`
> > swapused=`grep Swap: /proc/meminfo  | awk '{print $3}'`
> > echo $(( $physical - $used + $cache + $buffers - $swapused ))

 Hmm. A challenge. 

<?
 $physical=`grep Mem: /proc/meminfo  | awk '{print $2}'`;
 $used=`grep Mem: /proc/meminfo  | awk '{print $3}'`;
 $buffers=`grep Mem: /proc/meminfo  | awk '{print $6}'`;
 $cache=`grep Mem: /proc/meminfo  | awk '{print $7}'`;
 $swapused=`grep Swap: /proc/meminfo  | awk '{print $3}'`;
 echo $physical - $used + $cache + $buffers - $swapused;
?>

 Kinda similar, no ?

Kate, the multiskilled admin