I'm using sublime text 2's build systems to aid development of my mongodb + node.js server, which is really handy as it enables me to test my code without having to keep going back and to to the terminal. The downside is that it's very easy to absent-mindedly leave multiple node processes running in the background, which sometimes causes clashes when one of them is using a port I need in order to test another module.
Is there some way I can stop all node processes running within a given directory whenever I start a new process from that directory? A bash script or similar?