自动化SVN更新 [英] Automating svn update
问题描述
我经常ssh方式连接到服务器,切换到一个特定的目录和使用svn更新
I'm frequently sshing into a server, switching to a specific directory and running svn-update
我在想,有可能是自动这是一个非常简单的方法,所以我可以简单特定子目录,当我运行该脚本,它会通过SSH登录,cd到正确的目录并运行svn更新。
I'm thinking that there's probably a very easy way to automate this, so I can simple specific a subdirectory when I run the script and it'll login via SSH, cd to the right directory and run svn-update.
这是对Capistrano的工作或可能一个简单的bash脚本做的工作?
Is this a job for capistrano or could a simple bash script do the job?
推荐答案
听起来像是一个工作的cron 一>。执行的crontab ,并添加一个条目像这样:
Sounds like a job for cron. Execute crontab, and add an entry like so:
#min hour date month day command
0 * * * * ssh user@host '(cd path/to/working/copy; svn update)'
您可能需要设置 SSH密码认证使用ssh代理,使其赢得了 ŧ提示。
You may need to set up ssh passwordless authentication with ssh-agent so that it won't prompt.
编辑(每下面的注释):
EDIT (per comments below):
假设你有足够的权限这样做,运行
Assuming you have sufficient privileges to do so, run
ssh user@host crontab -e
然后添加一个条目,像这样:
Then add an entry like so:
#min hour date month day command
0 * * * * (cd path/to/working/copy; svn update)
您可以忽略编辑以上的部分,除非您的服务器不允许你使用cron。
You can ignore the part above the edit, unless your server doesn't allow you to use cron.
这篇关于自动化SVN更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!