我正在创建一个脚本,从 git 存储库中拉取一些内容。
但首先我想发送一个 SIGUSR1 到我在机器上运行的多个 Node ,一旦所有进程停止我将继续进行 git pull
基本上我会跑
killall -s SIGUSR1 node
因为我的 Node 正在执行无限循环,所以我想拦截此信号并在我知道它不会影响任何数据的循环部分中终止。
所以当所有 Node 都停止时我会继续
但是我如何在执行 git pull 并重新开始 Node 循环之前等待所有 Node 进程干净地退出
最佳答案
来自 man killall
:
-w, --wait
Wait for all killed processes to die. killall checks once per second if any of the
killed processes still exist and only returns if none are left. Note that killall may
wait forever if the signal was ignored, had no effect, or if the process stays in zombie
state.
关于node.js - 将 KillAll 发送到多 Node 进程并等待响应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47980136/