title: How to update code using svn with crontab?
body: <p>I am using following steps to update code on server after login to server:</p>
  
  <pre><code>sudo -s
  &lt;wrote password here&gt;
  cd /var/www/staging
  rm -r app.old
  mv app app.old
  svn checkout https://example.com/projectname/trunk/app app
  </code></pre>
  
  <p>Now I created <code>update.sh</code> file in <code>/var/www/</code> with following content</p>
  
  <pre><code>cd /var/www/staging
  rm -r app.old
  mv app app.old
  svn checkout https://example.com/projectname/trunk/app app
  </code></pre>
  
  <p>And I have following crontab entry to run after every 5 minutes:</p>
  
  <pre><code>*/5 * * * * /var/www/update.sh
  </code></pre>
  
  <p><strong>Problem:</strong> So cron job is working but it is only deleting the <code>app</code> folder and <strong>not</strong> checking out it from svn repository. But when I run <code>bash /var/www/update.sh</code> manually it works fine after <code>sudo -s</code>. </p>
  
  <p>How to fix this for cron job as well. Is it related to <code>sudo -s</code> or something else?</p>
  
  <p>Thanks</p>