as promised here are the scripts.

of course they come with a caveat, i am no powershell wiz, I have been
teaching myself PS using this as a learning exercise.

there are quite a few files here so I will add a few notes to tell you what
they do

if you want to debug these scripts download powergui (powergui.org) - oss,
it can debug scripts.

most of these scripts have a simple good-repository, bad-repository test
case to validate the main code-paths.

all of thoes 'start' scripts : these scripts is launchable from the 'dos'
command shell. You cant directly launch powersell 'functions' from dos, you
need to call them from other ps1 scripts, and for some reason you cant have
a function and a 'dos entry point' in the same ps1 file.

all of thoes 'do' scripts : these preform the dump, zip the dump, and copy
the dump to the location specified in the configuration file.

SubversionConfiguration.xml : all configuration options are read from here,
the 'start' and 'do' scripts need know the path to this file
daily_backup_reposiory.cmd : invoked form windows, all it does is start
powershell passing it the 'start' script
start_daily_backup_repository.ps1 : loads the 'SubversionParentPath' option
and executes the  do_daily_backup_repository function on each repository.
do_daily_backup_repository.ps1 : does the daily backup, this consists of
dumping all changes that occured between now and the last time it was
executed (it maintains a 'repository-name.head' file to let it know the last
revision that was a part of a daily backup)

weekly_backup_repository, this set of scripts is mostly the same as the
dailys, except the 'do' script dumps the entire repository.

post_commit_backup_revision : again makes the powershell script launchable
from dos
start_post_commit_backup_revision : no reason for this one, I just forgot to
remove it.
do_post_commit_backup_revision : drops the revision from the repository
passed into it into a dump file
minor note : your repository post-commit-hook will need to look like this
---
SET REPOS=%1
SET REV=%2
SET REPOS-NAME=repository

call
D:\MEDIA\PROFILE\Desktop\SubversionScripts\post_commit_backup_revision.cmd
"REPOS", "REV", REPOS-NAME
---
the reason for this is that at the time this particular code was written I
needed to pass in 'REPOS-NAME' in order to get the actual repository name,
anyhow there is a far better way to do this (use the .Name property of the
object) but i never got around to changing the code.

anyhow these scripts are by no means perfect - however they do work, when i
have more time they will be polished further and sent to the subversion guys
for inclustion into the 'contrib'

if you have any questions about these scripts let me know.

[edit] : ok, gmail doesnt allow .cmd files to be sent (of course), here is
the content of thoes files :

daily_backup_repository.cmd
:: sets up the approprate enviroment to call the powershell scripts from a
command prompt
C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe
D:\MEDIA\PROFILE\Desktop\SubversionScripts\start_daily_backup_repository.ps1
exit

post_commit_backup_revision.cmd
:: sets up the approprate enviroment to call the powershell scripts from a
command prompt

SET REPOS=%1
SET REV=%2
SET REPOS-NAME=%3

C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe
D:\MEDIA\PROFILE\Desktop\SubversionScripts\start_post_commit_backup_revision.ps1
-svn_repos %REPOS% -rev %REV% -repos_name %REPOS-NAME%
exit

weekly_backup_revision.cmd
:: sets up the approprate enviroment to call the powershell scripts from a
command prompt
C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe
D:\MEDIA\PROFILE\Desktop\SubversionScriptsstart_weekly_backup_repository.ps1
exit

On Wed, Oct 15, 2008 at 3:25 PM, steven higgan <[EMAIL PROTECTED]>wrote:

> hmmm yes backup scripts.
>
> I have a set of powershell scripts that do nightly (stuff that changed
> today), weekly (whole repository) and per-revision backup, compress, local
> and remote archiving.
>
> they were written for my employer (I have permission to distribute them)
> they do need to be 'cleaned' before I can send them to the list (which I
> will do tonight when I get home from work).
>
> if you don't hear form me by Friday ping me offlist (i tend to be
> forgetful)
>
>
> On Wed, Oct 15, 2008 at 6:22 AM, <[EMAIL PROTECTED]> wrote:
>
>>
>> What is the easist method of backup from the viepoint of a
>> administrator?
>> How can one automate this?
>> Is it enough if the repositories are copied?
>>
>> Sorry if this has been answered before ;-) Please then point me in the
>> right direction.
>>
>
>

Attachment: do_daily_backup_repository.ps1
Description: Binary data

Attachment: do_post_commit_backup_revision.ps1
Description: Binary data

Attachment: do_start_commit_check_merge_capeabilities.ps1
Description: Binary data

Attachment: do_weekly_backup_repository.ps1
Description: Binary data

Attachment: start_daily_backup_repository.ps1
Description: Binary data

Attachment: start_post_commit_backup_revision.ps1
Description: Binary data

Attachment: start_weekly_backup_repository.ps1
Description: Binary data

<Configuration>
	<LocalArchiveDirectory>D:\MEDIA\PROFILE\Desktop\SubversionScripts\test-data\local-archive</LocalArchiveDirectory>
	
	<RemoteArchiveDirectory>\\computer\remote-archive</RemoteArchiveDirectory>
	<RemoteArchiveUserName>user</RemoteArchiveUserName>
	<RemoteArchiveUserPassword>password</RemoteArchiveUserPassword>
	
	<SmtpServer>mailrelay</SmtpServer>
	<SmtpTo>[EMAIL PROTECTED]</SmtpTo>
	<SmtpFrom>[EMAIL PROTECTED]</SmtpFrom>
	
	<SubversionParentPath>D:\MEDIA\PROFILE\Desktop\SubversionScripts\test-data\repos</SubversionParentPath>
</Configuration>

Reply via email to