Svnsync automatisation via Windows Scheduler
Recently I’ve been setting up for a project, as you might have noticed, and one of the problems we ran into was the fact that we have a centralized subversion repository. We don’t have access to control or install anything on the actual server unfortunately, so hence we can’t install trac on that system, as previously explained. The solution is to sync the main subversion databases to the trac server as previously explained.
A secondary problem arising from this, is that we can’t actually change the hook files of the master repository. The solution to this, is to add a synchronizing scheduler. As I was stressed, and had no time to deal with this properly, I had to run with the Windows Scheduler of all horrible solutions. The following explains how to set it up.
Windows Scheduled synchronize Task
Warning! The windows scheduler does not start automatically when you reboot etc. If you do this, the task restarts at it’s start time, so if it’s set to run at 00.00 every day, and then every 5 minutes, it will restart and start running at 00.00, not as soon as the machine is started up again. This is pure evil.
A scheduled task is set up as follows, create a bat file (ie, c:projectssvnprojectsvnsync-project.bat):
svnsync synchronize http://localhost/svn/project –sync-username slaveuser –sync-password tjohej –source-password password
c:Python25Scriptstrac-admin.exe c:projectstracproject resync
The Second line unfortunately has to be done to resync the new changes with the trac database. After this, create a scheduled task in windows as follows:
- Go to start -> control panel -> scheduled tasks
- Click Add scheduled task
- Click Next
- Click Browse…
- Browse to your svnsync-project.bat file, as described above. Double click it.
- Set name (default is ok). Perform this task: Daily
- Click Next
- Start time: 00:00, Every day, Start date: today
- Fill in username/password to run it as.
- Select open advanced properties for this task. Click Finish.
- Go to tab Schedule. Choose Advanced.
- Click Repeat task, fill in Every 10 minutes, and click Time and fill in 23:59
- Click OK.
- Click OK
This could most likely be done from cruisecontrol, but as stated, i’m stressed. I hate windows by now (at/cron is just sooo much nicer to handle).