#/bin/bash
if [ "$1" == "start" ]
then
  valgrind --leak-check=full ./bnc -nw 2> valgrind.txt &
elif [ "$1" == "stop" ]
then
  kill -SIGINT `ps | grep memcheck | cut -b 1-6`
else
  echo "usage: run_valgrind start|stop"
fi