Linked Questions

121 votes
5 answers
229k views

Kill all descendant processes [duplicate]

I'm writing an application. It has the ability to spawn various external processes. When the application closes, I want any processes it has spawned to be killed. Sounds easy enough, right? Look up ...
MathematicalOrchid's user avatar
787 votes
6 answers
410k views

Difference between nohup, disown and &

What are the differences between $ nohup foo and $ foo & and $ foo & $ disown
Lesmana's user avatar
  • 27.6k
11 votes
2 answers
1k views

Bash script should only kill those instances of another script's that it has launched

In the current situation, a certain script 'calling.sh' launches another script 'called.sh' in the background, performs other operations, sleeps for a while, and then terminates 'called.sh' with a ...
XavierStuvw's user avatar
  • 1,129
9 votes
9 answers
9k views

Killing the previous instances of a script before running the same Unix script

I want to kill the background process belonging to a shell script that I am going to run again. That means before executing the shell script I want to delete the background process running for the ...
Abin's user avatar
  • 91
7 votes
3 answers
40k views

killing parent process doesn't kill child

I have a question. Studying processes management I observed a strange behavior, on a CentOS 7. I know that killing a parent process, the child processes are killed also. But not in the following case. ...
intore's user avatar
  • 399
7 votes
1 answer
2k views

Why does unshare based killing only work reliably with --fork?

From this answer we have learned that you can implement reliable killing of entire process subtrees with Linux PID namespaces via unshare -p. Here is problem with it that I don't understand: It only ...
nh2's user avatar
  • 1,721
5 votes
1 answer
2k views

Launch background processes in one group and later kill them all

The other day I tried writing a script that would kill a PID and all its children processes, but after spending some time on it, I decided it wasn't trustworthy, because sometimes some of the children ...
admirabilis's user avatar
  • 4,732
0 votes
2 answers
3k views

Bash Creates Child Process Using && and not with ; for a nohup programm

I have a macbook (default shell is zsh) I have an executable python script (srcript1.py). I use another executable script (called starter) that runs script1.py when my computer starts, the terminal ...
rafagarci's user avatar
3 votes
0 answers
3k views

Bash: kill process and all subprocesses without using group id

TL;DR, I need a way to kill a process and all descendant processes, without killing siblings with the same group id, without output printed in the terminal, and with a non-zero exit code. I have a ...
quantumbutterfly's user avatar
2 votes
2 answers
463 views

less stops my script; why is that and how to avoid?

I have this Bash script named as s in current directory: #!/bin/bash pipe_test() { ( set -m; ( $1 ); set +m ) | ( $2 ) } pipe_test "$1" "$2" If I call e.g. ./s yes ...
jarno's user avatar
  • 620