function onExitCallback()
{
echo "exit!"
pkill -9 test_monitor.sh
exit
}

trap 'onExitCallback' SIGTERM
trap 'onExitCallback' SIGINT

trap用于捕获Linux的信号。