Does anybody know how I can automatically run svn update
? If anybody has a script or something like that, could you show me an example?

- 3,115
- 3
- 49
- 77
-
How do you mean automatic? At what point should the update command be run automatically? – Fredrik Mörk May 28 '09 at 08:43
-
What operating system will you be using to do the updates (Windows, Linux, MacOS, etc)? – Elijah May 28 '09 at 08:43
-
7I would not really recommend using an automatic update. Strange things can happen when you have changes that conflict with somebody else's changes, but your local files are then updated anyway. – B.E. May 28 '09 at 08:46
5 Answers
I'm using TortoiseSVN. On the production server I have a scheduled task that runs the following batch file.
CD C:\Program Files\TortoiseSVN\bin\
START TortoiseProc.exe /command:update /path:"C:\www\MyRepo\" /closeonend:0
Hopefully this saves someone else some time!

- 7,022
- 16
- 53
- 66
-
4Great answer, thanks. Just adding a note to future readers who might want to update multiple directories simultaneously, see my question (and answer) here: http://superuser.com/a/689155/264136 – sab669 Dec 16 '13 at 17:02
-
2
-
3
-
2+1 This is perfect. I just need my production server to update. So as long as the working copy is clean I won't have to worry about conflicts (as I do not develop on the server). Thanks! – Milne Aug 21 '14 at 18:44
-
2+1, as someone new to managing a windows production server, this is very helpful. – will Aug 28 '14 at 15:23
I use SVN Notifier which sits in the system tray and notifies me every time the repository changes. And I can highly recommend it. It means you only update when there's something to update!
Alternatively you can set up a scheduled task/cron job to run svn update
in the appropriate directory every hour/day/whatever.
EDIT: OK, take a look at this Microsoft article on setting up a scheduled task.
You want a batch file called svnUpdate.bat or something which looks like this:
cd C:/path/to/your/working/copy
svn update
Get the scheduled task to run this as often as you like (once an hour seems sensible)
Make sure you have the command line version of svn installed (I use SlikSvn) and available on your PATH (in a command window type svn
and ensure it says 'Type svn help...' or similar.

- 9,898
- 7
- 40
- 59
-
1
-
1Could you write full script for update, because I dont know what to run, and don't see anythig like update in may Installed folder. – May 28 '09 at 08:56
-
The command 'svn update' runs the svn program and tells it to update. These is no separate 'update' program. In a command prompt try typing svn update to check it works – Mark Pim May 28 '09 at 08:58
-
I use this batch script to update my working copy every 5 seconds, as scheduled tasks and cron can only run scripts every minute `:begin\nsvn update C:\data\localweb\development\ntimeout 5\ngoto begin` where \n is newline – Lars Gyrup Brink Nielsen Oct 15 '13 at 12:25
-
you could also write (instead of switching directory): `svn update %path%` – skofgar Feb 21 '14 at 11:51
@echo off
cls
echo == Initiating system instance variables...
echo. -- Setting the variables...
:: Here you need to make some changes to suit your system.
set SOURCE=C:\sauce\CURRENT
set SVN=C:\Program Files\TortoiseSVN\bin
:: Unless you want to modify the script, this is enough.
echo. %SOURCE%
echo. %SVN%
echo. ++ Done setting variables.
echo.
echo == Updating source from SVN
echo. -- Running update...
"%SVN%\TortoiseProc.exe" /command:update /path:"%SOURCE%" /closeonend:2
echo. ++ Done.
echo. -- Cleaning up...
set SOURCE=
set SVN=
echo. ++ Done.
If you are using TortoiseSVN then the above batch script will suit fine. Otherwise you can just modify it to use whatever SVN client you are currently using. Just pop this in a .bat file and run it on demand.

- 311
- 1
- 10
-
This is the relevant portion for a much larger "Build, destroy and deploy" script I wrote so there might be some comments or echos that you might prune. – varl May 28 '09 at 09:06
-
-
-
2You can put this batch file on your desktop. Modify the SOURCE variable (I use C:\sauce\CURRENT) to whatever directory you have your checked out trunk in. The SVN variable I set to the installation directory where TortoiseSVN (an SVN client) can be found. The script then runs the TortoiseSVN executable with a few parameters to tell Tortoise what directory to run an SVN update on. This will update your project with the newest files from the SVN repository. Not the application itself. – varl May 28 '09 at 09:17
-
You can easily modify this script to run the update command from whatever SVN client you are currently using. – varl May 28 '09 at 09:18
You can also download and use Commit-Monitor from http://code.google.com/p/commitmonitor/. It monitors SVN repositories for commits and notifies the user when it happens. It is in GNU GPL, ver 2.

- 155
- 1
- 3
- 12
Note: Once I know your operating system, I will be able to give you a more detailed answer.
General Instructions
- Never change anything in the local repository.
- Read this link on how to use AT to schedule from the command line in windows.
Use the AT command to schedule the following command (assuming you have the command-line version of svn installed):
svn update reporsitory_directory
Profit!

- 13,368
- 10
- 57
- 89
-
-
Then you could just create a windows shortcut that executes svn update repository_directory – Elijah May 28 '09 at 08:58
-
Look, I don't have .exe file in my repository directory witch run update. I can give you list of all files in my repository folder. – May 28 '09 at 09:04