Skip to content

Instantly share code, notes, and snippets.

@yjzhang
Created February 16, 2019 01:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yjzhang/030fbb2f7a594cfe8e9f34af3ae00eab to your computer and use it in GitHub Desktop.
Save yjzhang/030fbb2f7a594cfe8e9f34af3ae00eab to your computer and use it in GitHub Desktop.
kills all gunicorn processes with a certain port number. useful for when there are multiple gunicorns running on different ports.
#!/bin/bash
# kills all gunicorn processes with 8889
pids=`ps ax | grep gunicorn | grep "8889" | awk '{split($0,a," "); print a[1]}'`
# TODO
for pid in $pids; do
killall -9 $pid
echo "killed gunicorn process $pid"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment