Skip to content

Instantly share code, notes, and snippets.

@carlevans719
Created January 4, 2018 09:34
Show Gist options
  • Save carlevans719/a93d907a54f5539fd21061fab8f240bc to your computer and use it in GitHub Desktop.
Save carlevans719/a93d907a54f5539fd21061fab8f240bc to your computer and use it in GitHub Desktop.
Kill all threads of a process
#!/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