How to propagate a signal through a collection of scripts?

后端 未结 4 1633
Happy的楠姐
Happy的楠姐 2020-12-15 18:14

I have an collection of scripts which are controlled by a main one. I want to trap the signal ctrl+c in the main script and propagate it to the others.

4条回答
  •  猫巷女王i
    2020-12-15 18:35

    Have you tried to : 1) Setup your traps in every script (master / childs) where you need them 2) Send to the master a kill with it's PID negated, to kill the whole process group, I mean :

    kill -15 -$PID
    

    man kill | grep -C1 Negative

提交回复
热议问题