Auto svn-recover on old svn systems

Submitted by DenRaf on Fri, 08/24/2007 - 23:39

These days if you are using the latest svn with berkely db, this is not one of your problems. Auto-recovery is build-in.

But for people like me that stick by their old svn for various reasons it is a waist of time for recovering every corrupted repository. For making it yourself easy, you make a script for that, that you hit when you noted that a repository was corrupted. But still, not easy enough. So you make a script that checks every repository configured and if one is corrupted, fixing it at the same time. Good, now we are getting there, but still. Sometimes the check will hang endlessly and so will your script. So what then?

Expect. Use expect to check your repository and add a timeout. So when the check will hang, kill it after the timeout is reached.
Expect expects various outputs of the command it executes, and for each expect rule you can do something. For instance giving it an exit-code.

I noted something quiet important, expect 5.42 only compares to the last line of a multi-line response of the command it executes.

You can find my script here.

Almost everything is configurable, even mail notification.

You can add this script to your cron tasks, so you just have to do nothing IF one fails.