It’s not uncommon for me to wonder if some app is running on my linux box, and while I could pipe together ps and a couple greps it felt silly to keep doing it after a while. So, I applied my admittedly limited bash skills and came up with the following script which I throw that in an executable called “got”. Now I can just type “got tomcat?” (the question-mark is optional). If anything is running with “tomcat” in it’s command it’ll give me the skinny on it. Otherwise it’ll let me know it wasn’t found.
</p>
<p>#!/bin/bash<br />
APP=`echo $1 | sed s/?$//`<br />
RESULTS=`ps -A S| grep $APP | grep -v grep | grep -v “got $APP”`<br />
if [ "$RESULTS" != "" ]; then<br />
echo $RESULTS<br />
else<br />
echo “No $APP found with ps -A S”<br />
fi</p>
<p>
If you can improve on this, please let me know.