[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

RE: Problems with hot_backup.py on Windows XP

From: David Colton <DColton_at_curamsoftware.com>
Date: 2005-04-07 17:17:48 CEST

As I get digest I haven't gotten John Szakmeister's reply yet. However it's
not a problem with the path to svnadmin either. I have modified the entry at
the top of the file and printed it out to screen to be sure [it might be a
windows thing because of the space in the "Program Files" directory but I've
also given the script the short form of the path e.g.
C:\Progra~1\Subver~1\bin\svnadmin with the same results].

 

As a result I've fallen back on what I know best ... Ant. Here is the script
I've written to backup the repository, keeping seven days worth of backups.
If there have been no change-set commits since the last backup I do nothing
- no backup or clean up. Hope this is of interest to someone. The usual use
at your own risk statements apply. I'm open to questions and suggestions.

 

<project name="BackupSubversion" basedir="." default="yesBackupNeeded">

    <property name="backup_dir" value="T:\SCM\SVNBackups"/>

    <property name="repository_dir" value="C:\SVNRepository"/>

    <target name="getYoungest">

        <exec dir="${backup_dir}" executable="svnlook.exe"
outputproperty="youngest">

            <arg line="youngest ${repository_dir}"/>

        </exec>

        <property name="backup_instance"
value="${backup_dir}\RepositoryVersion-${youngest}"/>

        <echo message="youngest: ${youngest}"/>

        <echo message="backup_instance: ${backup_instance}"/>

    </target>

    <target name="isBackupNeeded" depends="getYoungest">

        <available file="${backup_instance}" type="dir"
property="backup_needed"/>

    </target>

    <target name="noBackupNeeded" depends="isBackupNeeded"
if="backup_needed">

        <echo message="No commits since last backup ... Exiting"/>

    </target>

    <target name="yesBackupNeeded" depends="noBackupNeeded"
unless="backup_needed">

        <echo message="Backup directory for youngest change set ${youngest}
does not exist."/>

        <mkdir dir="${backup_instance}"/>

        <echo message="Starting backup ${backup_instance}."/>

        <exec dir="${backup_dir}" executable="svnadmin.exe"
outputproperty="exit_value">

            <arg line="hotcopy ${repository_dir} ${backup_instance}"/>

        </exec>

        <echo message="hot copy exit value: ${exit_value}"/>

        <tstamp>

            <format property="out_of_date" pattern="MM/dd/yyyy hh:mm aa"
offset="-7" unit="day"/>

        </tstamp>

        <echo message="out_of_date: ${out_of_date}"/>

        <delete includeEmptyDirs="true">

            <fileset dir="${backup_dir}" includes="**">

                <date datetime="${out_of_date}" pattern="MM/dd/yyyy hh:mm
aa" when="before"/>

            </fileset>

        </delete>

    </target>

</project>

The information in this email is confidential and may be legally privileged.
It is intended solely for the addressee. Access to this email by anyone else
is unauthorized. If you are not the intended recipient, any disclosure,
copying, distribution or any action taken or omitted to be taken in reliance
on it, is prohibited and may be unlawful. If you are not the intended
addressee please contact the sender and dispose of this e-mail. Thank you.

The information in this email is confidential and may be legally privileged.
It is intended solely for the addressee. Access to this email by anyone else
is unauthorized. If you are not the intended recipient, any disclosure,
copying, distribution or any action taken or omitted to be taken in reliance
on it, is prohibited and may be unlawful. If you are not the intended
addressee please contact the sender and dispose of this e-mail. Thank you.
Received on Thu Apr 7 17:20:39 2005

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.