title: Wrong ruby path used in rake task executed as cron through whenever
body: <p>I am trying to use the <a href="https://github.com/javan/whenever" rel="nofollow">whenever</a> gem to execute a couple of rake tasks.  It appears to set up the cron tasks correctly - info here is from the mail output that is produced. Here's an example of the command executed:</p>
  
  <pre><code>/bin/bash -l -c 'cd /path/to/deployed/app &amp;&amp; RAILS_ENV=production
  </code></pre>
  
  <p>rake clean:my:task --silent'</p>
  
  <p>And here are some of the environment variables:</p>
  
  <pre><code>X-Cron-Env: &lt;SHELL=/bin/sh&gt;
  X-Cron-Env: &lt;PATH=/usr/bin:/bin&gt;
  </code></pre>
  
  <p>And here is the error that follows:</p>
  
  <pre><code>/bin/bash: /usr/bin/rake: /usr/bin/ruby: bad interpreter: No such file or directory
  </code></pre>
  
  <p>When i'm logged in i can run these rake tasks from the same directory, but when i run</p>
  
  <pre><code>which ruby
  </code></pre>
  
  <p>i get </p>
  
  <pre><code>/usr/local/bin/ruby
  </code></pre>
  
  <p>There does appear to be a 'rake' in /usr/bin, but running</p>
  
  <pre><code>/usr/bin/rake -T
  </code></pre>
  
  <p>gives me the same error:</p>
  
  <pre><code>-bash: /usr/bin/rake: /usr/bin/ruby: bad interpreter: No such file or directory
  </code></pre>
  
  <p>What would be the <strong>best way</strong> to resolve this?</p>