title: Rails cron with whenever, setting the environment
body: <p>This question will probably only make sense if you know about the whenever gem for creating cron jobs. I have a task in my schedule.rb like </p>
  
  <pre><code>every 1.day, :at =&gt; '4am' do
    command "cd #{RAILS_ROOT} &amp;&amp; rake thinking_sphinx:stop RAILS_ENV=#{RAILS_ENV}"
    command "cd #{RAILS_ROOT} &amp;&amp; rake thinking_sphinx:index RAILS_ENV=#{RAILS_ENV}"
    command "cd #{RAILS_ROOT} &amp;&amp; rake thinking_sphinx:start RAILS_ENV=#{RAILS_ENV}"
  end
  </code></pre>
  
  <p>However when I update my crontab using</p>
  
  <pre><code>whenever --update-crontab appname --set environment=production
  </code></pre>
  
  <p>the cron jobs still have RAILS_ENV=development.  My tasks on production and development are the same right now, I just need to change the environment variable because thinking_sphinx needs to know the current environment.  Any ideas on how to do this?</p>
  
  <p>Thanks!</p>