I'd like to run the CoffeeScript and the Sass compilers in the background, and be able to kill them both at once. I have a bash script start, like this:
coffee --watch -o assets/ -c src/ &
sass --watch src:assets &
When started from a script file, they don't appear in the jobs list, so I can't kill them with:
kill `jobs -p`
as suggested in this post. They do appear in the ps output as being attached to my tty.
What is a good way to kill the processes started by my start script?
My aim is to start the compilers with ./start and kill them with a ./stop script. I'm using OSX Lion.
Edit: Based on grawity's answer, now I'm using:
coffee --watch -o assets/ -c src/ &
coffeepid=$!
sass --watch src:assets
kill $coffeepid
The Sass compiler complains if it is stopped using kill, so I'm stopping it with Ctrl-C then killing the background CoffeeScript compiler.
kill -INT. – grawity Sep 1 '11 at 9:28