How to close all background processes in unix?

Posted by Gabi Purcaru on Super User See other posts from Super User or by Gabi Purcaru
Published on 2011-01-04T10:25:31Z Indexed on 2011/01/04 11:55 UTC
Read the original article Hit count: 281

Filed under:
|
|
|

I have something like:

cd project && python manage.py runserver &
cd utilities && ./coffee_auto_compiler.py

And I want both of them to close on Ctrl-C (or some other command). How can I accomplish that?

EDIT: I tried using jobs -x kill and kill `jobs -p `, but it doesn't seem to kill what I need. Here is what I mean:

moon      8119  0.0  0.0   7556  3008 pts/0    S    13:17   0:00 /bin/bash
moon      8120  6.8  0.4  24568 18928 pts/0    S    13:17   0:00 python manage.py runserver

jobs -p give me just process 8119, but I also need to close 8120, since it's the thing that the first command opened.

If it helps, the commands are actually in a Makefile, and I want it to run two daemons at the same time (and somehow close them at the same time). And yes, I'm using ubuntu, with bash

© Super User or respective owner

Related posts about linux

Related posts about command-line