Skip to content

Instantly share code, notes, and snippets.

@srstanic
Last active December 9, 2015 23:48
Show Gist options
  • Save srstanic/4346448 to your computer and use it in GitHub Desktop.
Save srstanic/4346448 to your computer and use it in GitHub Desktop.
Kill zombie processes Foreman started
#!/bin/bash
kill -9 `lsof -P -i :5000 | sed -n 's/python *\([0-9]*\).*\:5000.*/\1/p'`
@lemuelf
Copy link

lemuelf commented Jan 30, 2013

I think pkill will also do? I'm not sure if the -n option to pkill (newest matching) would always result to the same process returned by lsof, though.

pkill -fn 'python.*\:5000'

seems to have the same result for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment