title: Shell script (with top command) not working in cronjob
body: <p>Cron expression:</p>
  
  <p><code># m h  dom mon dow   command
  */1 * * * * /home/sysadmin/sample.sh</code></p>
  
  <p>Shell Script content:</p>
  
  <pre><code>#!/bin/bash
  clear
  Vardate=`date`
  topresult=`top -n 1| grep Cpu`
  # CPUStatus=$Vardate"\t"$topresult
  # echo $CPUStatus &gt;&gt; /tmp/data.log
  echo $Vardate"   "$topresult &gt;&gt; /tmp/data.log
  </code></pre>
  
  <p>When i exeute the script manually, I get the desired output. Which is:</p>
  
  <pre><code>Wed Sep 23 02:42:47 MDT 2015   Cpu(s): 0.3%us, 0.3%sy, 0.0%ni, 99.4%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
  </code></pre>
  
  <p>But when the cronjob executes it, the output is as follows:</p>
  
  <pre><code>Wed Sep 23 02:42:47 MDT 2015 
  </code></pre>
  
  <p>What can be the reason for this?</p>