title: Cron and virtualenv
body: <p>I am trying to run a Django management command from cron. I am using virtualenv to keep my project sandboxed.</p>
  
  <p>I have seen examples here and elsewhere that show running management commands from within virtualenv's like:</p>
  
  <pre><code>0 3 * * * source /home/user/project/env/bin/activate &amp;&amp; /home/user/project/manage.py command arg
  </code></pre>
  
  <p>However, even though syslog shows an entry when the task should have started, this task never actually runs (the log file for the script is empty). If I run the line manually from the shell, it works as expected. </p>
  
  <p>The only way I can currently get the command to run via cron, is to break the commands up and put them in a dumb bash wrapper script:</p>
  
  <pre><code>#!/bin/sh
  source /home/user/project/env/bin/activate
  cd /home/user/project/
  ./manage.py command arg
  </code></pre>
  
  <p>EDIT:</p>
  
  <p>ars came up with a working combination of commands:</p>
  
  <pre><code>0 3 * * * cd /home/user/project &amp;&amp; /home/user/project/env/bin/python /home/user/project/manage.py command arg
  </code></pre>
  
  <p>At least in my case, invoking the activate script for the virtualenv did nothing. This works, so on with the show.</p>