Skip to content

Instantly share code, notes, and snippets.

@electrum
Created June 5, 2009 23:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save electrum/124578 to your computer and use it in GitHub Desktop.
Save electrum/124578 to your computer and use it in GitHub Desktop.
!/bin/bash
# kill currently running java process
echo "Java processes: $(pgrep java)"
pkill -9 java
for i in $(seq 1 20)
do
sleep 1
pgrep java || exit
echo "Java still running: $(pgrep java)"
pkill -9 java
done
echo "Failed to kill Java"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment