svnbak.pl: killer Subversion repository backup script

Timbo White
Executing svnbak.pl

svnbak.pl executing

Download version 0.0.5

What is it?

A Perl cron script that creates and rotates backups of one or more Subversion repositories.

What does it do?

  1. Verifies repositories (svnadmin verify)
  2. Hot copies -or- dumps repositories (uses svnadmin hotcopy -or- svnadmin dump)
  3. Archives all repositories to a single tar file
  4. Gzips tar file
  5. Backup rotation

Other Features

  • Email notifications
  • Nice output
  • Free

Requirements

Operating System: *nix
Perl (5.8.5 or higher)
Subversion
tar
gzip

Proc::Reliable
MIME::Lite
Math::Round

Configure

svnbak.pl: Configuration Section

svnbak.pl Configuration Section

At the top of svnbak.pl is a “Configuration Section” that you must add specific information to in order for the script to work.

  • reposDir: full path to your Subversion repository, or the parent directory of all your repositories.
  • destDir: full path to the directory where the backups should be saved.  To save backups to a network file system, first mount the file system, then specify the mounted path.
  • maxBaks: maximum number of backups to retain.  Once this limit is reached, the script will automatically remove the oldest backup based on it’s last modified time.
  • svnBakMethod: type of Subversion backup to create (’hotcopy‘ or ‘dump‘).
  • tarballName: the name of the backup file.  Each backup file will be appended with a 14 digit time stamp to preserve singularity.
  • tmpDir: full path to a new temporary directory to store files before tarballing.  This directory should not be an existing directory - it will be deleted!
  • emailPref: when the admin should receive emails (’always’, ‘errors’, ‘none’).
  • displayTime: display execution time in seconds, per task.

Download version 0.0.5

Change Log

0.0.5 - 20090326

  • added backup option of dumping repositories via svnadmin dump
  • increased error checking
  • fixed: some repositories skipped when there was a large number of repositories

0.0.1 - 20090108

  • initial release

Source

1 Comment on “svnbak.pl: killer Subversion repository backup script”

  1. #1 matt bowman
    on May 5th, 2009 at 9:28 am

    doesn’t seem to deal witha single repository.. tries to join the dirname and repo name..

    works fine with a directory containing repos.. but not specifiying the repo itself

Leave a Comment