dongtiran7769
2012-04-04 11:15
浏览 42

如何使用crontab使用svn更新代码?

I am using following steps to update code on server after login to server:

sudo -s
<wrote password here>
cd /var/www/staging
rm -r app.old
mv app app.old
svn checkout https://example.com/projectname/trunk/app app

Now I created update.sh file in /var/www/ with following content

cd /var/www/staging
rm -r app.old
mv app app.old
svn checkout https://example.com/projectname/trunk/app app

And I have following crontab entry to run after every 5 minutes:

*/5 * * * * /var/www/update.sh

Problem: So cron job is working but it is only deleting the app folder and not checking out it from svn repository. But when I run bash /var/www/update.sh manually it works fine after sudo -s.

How to fix this for cron job as well. Is it related to sudo -s or something else?

Thanks

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

2条回答 默认 最新

相关推荐 更多相似问题