I'm frequently sshing into a server, switching to a specific directory and running svn-update
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.
Is this a job for capistrano or could a simple bash script do the job?
Simply type svn update [name-of-directory] , or cd to that directory and type svn update there. Show activity on this post.
Description. svn update brings changes from the repository into your working copy. If no revision is given, it brings your working copy up to date with the HEAD revision. Otherwise, it synchronizes the working copy to the revision given by the --revision ( -r ) option.
When you update, the contents of your working copy are updated with all of the changes that have been committed to the repository since you last updated. Subversion is pretty smart about updating and never just overwrites files that have local changes with copies from the repository.
The Jenkins Subversion plugin uses SvnKit as the subversion client and doesn't require a native client to be available on the host. Setting up a CI server with Jenkins and Subversion is limited to a very minimal installation process: just run the Jenkins WAR and you're done.
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)'
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)
You can ignore the part above the edit, unless your server doesn't allow you to use cron.
Perhaps you should ask yourself why you are performing this action?
Could a build server such as CruiseControl or Hudson solve the more general case (of knowing when a svn commit has been performed)?
If you need monitoring on a specific svn server, and you have administration access to it, you can enable a post-commit hook to the server, for instance to send you an email on every commit (or only on some specific types of commits).
It would help, if you could clarify the usecase of your situation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With