#!/bin/bash
MBEPID=`ps -fU mythtv |grep mythbackend |grep -v runsv|grep -v grep|grep -v logger|awk '{print $2 }'`
MFEPID=`ps -ef|grep mythfrontend |grep -v runsv|grep -v grep|grep -v logger|grep -v mythfrontend-start|awk '{print $2 }'`



COLOR=green      # By default, everything is OK

   # Do whatever you need to test for something
if [ ! x$MBEPID = x ]
then
VmSize=`cat /proc/$MBEPID/status|grep -i vmsize|awk '{print $2 }'`
VmPeak=`cat /proc/$MBEPID/status|grep -i vmpeak|awk '{print $2 }'`
VmRSS=`cat /proc/$MBEPID/status|grep -i vmrss |awk '{print $2 }'`
MSGMBE="
	VmSize:$VmSize
	VmPeak:$VmPeak
	VmRSS:$VmRSS
	"
#	echo $MSGMBE
 # Tell Hobbit about it
   $BB $BBDISP "data $MACHINE.memmbe $COLOR `date`

   ${MSGMBE}

   " 
fi
   


if [ ! x$MFEPID = x ]
then
VmSize=`cat /proc/$MFEPID/status|grep -i vmsize|awk '{print $2 }'`
VmPeak=`cat /proc/$MFEPID/status|grep -i vmpeak|awk '{print $2 }'`
VmRSS=`cat /proc/$MFEPID/status|grep -i vmrss |awk '{print $2 }'`
MSGMBE="
	VmSize:$VmSize
	VmPeak:$VmPeak
	VmRSS:$VmRSS
	"
#	echo $MSGMBE
 # Tell Hobbit about it
   $BB $BBDISP "data $MACHINE.memmfe $COLOR `date`

   ${MSGMBE}

   " 
fi