Bash管和SIGTERM

jld*_*ont 6 linux bash pipe supervisord

我有一个Bash脚本"脚本"大致如下所示:

#!/bin/bash

cmd1 | cmd2 | cmd3
Run Code Online (Sandbox Code Playgroud)

当我这样做时kill script(或者更确切地说,当我执行"停止脚本"时supervisord),并非所有cmd*都被杀死.如何确保它们与产生它们的脚本一起终止?

mhe*_*her 6

Supervisord具有stopasgroupkillasgroup选项(默认为false),用于确定是否将SIGTERM/SIGKILL信号传播到子进程.

[program:script]
command=script
stopasgroup=true
killasgroup=true
Run Code Online (Sandbox Code Playgroud)

(这些配置变量都记录在http://supervisord.org/configuration.html.)