How does bash handle SIGTERM?
by berndbausch from LinuxQuestions.org on (#5B71K)
According to the Bash Reference:
Quote:
When I send SIGTERM to the current bash process, indeed it is ignored. However, when I send SIGTERM to another interactive bash process, that process is terminated. Even setting up a trap doesn't change this.
Is this a misunderstanding? A bug? Something else?
On Centos 8.1:
Code:$ bash --version
GNU bash, version 4.4.19(1)-release (x86_64-redhat-linux-gnu)
$ ps
PID TTY TIME CMD
8372 pts/14 00:00:00 ps
12404pts/14 00:00:00 bash
$ kill -TERM 12404
$ ps
PID TTY TIME CMD
8373 pts/14 00:00:00 ps
12404pts/14 00:00:00 bash
$ ps -ef | grep 8337
user13 8337 13532 0 18:51 pts/4 00:00:00 bash
$ kill -TERM 8337
$ ps -ef | grep 8337
$Same result with version 5.0.17(1) running on Ubuntu 20 on WSL.


Quote:
When Bash is interactive, in the absence of any traps, it ignores SIGTERM |
Is this a misunderstanding? A bug? Something else?
On Centos 8.1:
Code:$ bash --version
GNU bash, version 4.4.19(1)-release (x86_64-redhat-linux-gnu)
$ ps
PID TTY TIME CMD
8372 pts/14 00:00:00 ps
12404pts/14 00:00:00 bash
$ kill -TERM 12404
$ ps
PID TTY TIME CMD
8373 pts/14 00:00:00 ps
12404pts/14 00:00:00 bash
$ ps -ef | grep 8337
user13 8337 13532 0 18:51 pts/4 00:00:00 bash
$ kill -TERM 8337
$ ps -ef | grep 8337
$Same result with version 5.0.17(1) running on Ubuntu 20 on WSL.