title: How to read grep command result in linux?
body: <p>I want to monitor jboss server status in linux for keep up &amp; running the application.My requirement is  if server down , i need to get the email from server.</p>
  
  <p>So i'm planning to run crontab in linux for every hour or half an hour to check the server status.</p>
  
  <pre><code>30 * * * * ps -ef|grep java | mail test@domain.com
  </code></pre>
  
  <p>I' will get grep command result when running above command. So How to read the grep command result to find server is up &amp; running ?</p>
  
  <p>Please advise if anybody have alternative.</p>