#!/bin/bash FFMAXMEM=1000000 FFMEM=`ps axu |grep firefox-bin |grep -v grep |grep -v sh |awk '{print $5}'` FFPID=`ps axu |grep firefox-bin |grep -v grep |grep -v sh |awk '{print $2}'` if [ "$FFMEM" -gt "$FFMAXMEM" ]; then kill $FFPID logger killed firefox process $PID because it was using $FFMEM memory, the maximum memory it can use is $FFMAXMEM else logger did not kill firefox process $FFPID, it is using $FFMEM memory fi