I’m creating a script that makes some pull from a git repository.
but first i want to send a SIGUSR1 to multiple nodes that i have running in the machine, and once all the procesess stop i will proceed to git pull
so basicly i will run
killall -s SIGUSR1 node
because my node is doing an infinite loop, i want to intercept this signal and kill in a portion of the loop where i know it won’t affect any data.
So when all the nodes are stopped i will continue
but how do i wait for all the node process exit cleanly before doing the git pull and starting again the node loop
Advertisement
Answer
From 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.