title: How to check if JBoss is running on Unix server?
body: <p>I have a script below that I'd like to echo out "jboss not running" or "jboss is running" depending on whether it can find the jboss process in the process list. However, when I shut down Jboss it still executes the Else condition and says "jboss is running". If I manually do "pgrep -f jboss" it doesn't return anything, so why is it still going into the Else condition? <em>puzzled</em></p>
  
  <pre><code>#!/bin/bash
  if [ -z "$(pgrep -f jboss)" ]
    then
    echo "jboss is not running"
  else
    echo "jboss is running"
  fi 
  </code></pre>
  
  <p>Thanks for your help!</p>