0

下面的脚本写在 start.sh

trap 'kill -TERM ${consul_watch_pid} ${abc_pid} ${pqr_pid}; echo "start.sh got SIGTERM"; wait ${consul_watch_pid} ${abc_pid} ${pqr_pid}' TERM

    consul watch -http-addr=${hostIP}:7000 -type=key -key=${consul_kv_key} /consul_handler.sh 2>&1 &
    consul_watch_pid=$!

    /abc.sh &
    abc_pid=$!

    /pqr.sh &
    pqr_pid=$!

    sleep 5000d &
    wait $!

    wait ${consul_watch_pid} ${abc_pid} ${pqr_pid}

    echo 'start.sh exiting'

我想将 start.sh 收到的 TERM 信号转发到 /consul_handler.sh、/abc.sh 和 /pqr.sh 但是 /consul_handler.sh 没有收到 SIGTERM。如何将 SIGTERM 传播到 /consul_handler.sh ?

4

0 回答 0