Created
September 7, 2018 12:45
-
-
Save dcragusa/98968ac661c13ab6c3069065da8074b8 to your computer and use it in GitHub Desktop.
Kill a process (and any spawned subprocesses) by PID
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo killing | |
# Get progress group id from pid | |
PGID=$(ps opgid `cat ${PID_PATH}` | grep -o '[0-9]*') | |
# Kill the process group | |
kill -- -$PGID | |
echo killed | |
# Now that it's killed, don't forget to remove the PID file | |
rm ${PID_PATH} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment