Last active
July 28, 2016 21:21
-
-
Save metaquanta/0c3eac0207a57a0d4586a2a408aadd57 to your computer and use it in GitHub Desktop.
For when you need to quit an Eclipse running in a different X session:
This file contains 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/sh | |
ECLIPSE_VERSION=46 | |
ECLIPSE_HOME= ## path to the jar referenced in the next line ## | |
ECLIPSE_CMDLINE_MATCH="jar ${ECLIPSE_HOME}/plugins/org.eclipse.equinox.launcher" | |
# This just leaves an orphan | |
killall eclipse${ECLIPSE_VERSION} 2> /dev/null | |
# This still just leaves an orphan | |
killall eclipse 2> /dev/null | |
ECLIPSE_JAVA_PID=`\ | |
ps xo pid,cmd \ | |
| grep "${ECLIPSE_CMDLINE_MATCH}" \ | |
| grep -v grep \ | |
| grep -o -P '^ *\d+' \ | |
| grep -oP '\d*' \ | |
` | |
if [ -n "$ECLIPSE_JAVA_PID" ] | |
then | |
# This really kills it | |
kill ${ECLIPSE_JAVA_PID} | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment