Created
January 4, 2018 09:34
-
-
Save carlevans719/a93d907a54f5539fd21061fab8f240bc to your computer and use it in GitHub Desktop.
Kill all threads of a process
This file contains hidden or 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
#!/bin/bash | |
#### Version 1 | |
kill -9 $(pidof liquidsoap) | |
#### Version 2 | |
SKIPPED_FIRST_ROW=false | |
PIDS=$(ps -u liquid -C liquidsoap -o pid=) | |
while read -r PID; do | |
if [ "$SKIPPED_FIRST_ROW" == true ]; then | |
kill -9 $PID | |
fi | |
SKIPPED_FIRST_ROW=true | |
done <<< "$PIDS" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment