I'm trying to back up our svn repositories, and I found a nice little backup command line bzip's the backup and creates the md5 hash all in one: svnadmin dump --deltas /repo |bzip2 |tee dump.bz2 | md5sum >dump.md5 The problem is I need to split the backups, so this doesn't really work. Is there perhaps another way of piping things to allow for splitting of the backups? Currently I'm doing something like this svnadmin dump --deltas /repo |bzip2 |split - -b 64m cat *.bz2* | md5sum >dump.md5 Is there a way to do this all in one step? Russ
On Fri, Nov 09, 2007 at 12:53:00PM -0500, Ruslan Sivak wrote:> I'm trying to back up our svn repositories, and I found a nice little > backup command line bzip's the backup and creates the md5 hash all in one: > > svnadmin dump --deltas /repo |bzip2 |tee dump.bz2 | md5sum >dump.md5 > > The problem is I need to split the backups, so this doesn't really work. > Is there perhaps another way of piping things to allow for splitting of the > backups? Currently I'm doing something like this > > svnadmin dump --deltas /repo |bzip2 |split - -b 64m > cat *.bz2* | md5sum >dump.md5 > > Is there a way to do this all in one step?Would something as simple as: svnadmin dump --deltas /repo | bzip2 | split - -b 64m && cat *.bz2* | md5sum >dump.md5 Work for you? :) Ray
> I'm trying to back up our svn repositories, and I found a nice little > backup command line bzip's the backup and creates the md5 hash all in one: > > svnadmin dump --deltas /repo |bzip2 |tee dump.bz2 | md5sum >dump.md5 > > The problem is I need to split the backups, so this doesn't really work. > Is there perhaps another way of piping things to allow for splitting of > the backups? Currently I'm doing something like this > > svnadmin dump --deltas /repo |bzip2 |split - -b 64m > cat *.bz2* | md5sum >dump.md5 > > Is there a way to do this all in one step?What about: svnadmin dump --deltas /repo | bzip2 | tee >(split -b 64m - dump.bz2.) | md5sum > dump.md5 -Shad
On Fri, 9 Nov 2007, Ruslan Sivak wrote:> I'm trying to back up our svn repositories, and I found a nice > little backup command line bzip's the backup and creates the md5 > hash all in one:If you have a newer Subversion, svnsync is great for this, albeit without the md5 sums. The destination repository is an exact replica, revision properties and all, of the source repo. E.g., svnadmin create /srv/svn/myrepo.bak echo '#!/bin/sh' > /srv/svn/myrepo.bak/hooks/pre-revprop-change chmod +x /srv/svn/myrepo.bak/hooks/pre-revprop-change svnsync init file:///srv/svn/myrepo.bak http://src.me.com/svn/myrepo svnsync sync file:///srv/svn/myrepo.bak Then, somewhat regularly, svnsync sync file:///srv/svn/myrepo.bak -- Paul Heinlein <> heinlein at madboa.com <> http://www.madboa.com/
Ross S. W. Walker
2007-Nov-12 22:54 UTC
[CentOS] backups and md5 all in one while splitting
'tee' splits the stdin into multiple output streams. The first instance of tee you listed gave it a file name and a pipe to output the stdout to. The second instance did a redirection to a sub-shell which then passed it to 'split' and it also had a pipe. -Ross -----Original Message----- From: centos-bounces at centos.org <centos-bounces at centos.org> To: CentOS mailing list <centos at centos.org> Sent: Mon Nov 12 17:44:47 2007 Subject: Re: [CentOS] backups and md5 all in one while splitting Shad L. Lords wrote:>> I'm trying to back up our svn repositories, and I found a nice little >> backup command line bzip's the backup and creates the md5 hash all in >> one: >> >> svnadmin dump --deltas /repo |bzip2 |tee dump.bz2 | md5sum >dump.md5 >> >> The problem is I need to split the backups, so this doesn't really >> work. Is there perhaps another way of piping things to allow for >> splitting of the backups? Currently I'm doing something like this >> >> svnadmin dump --deltas /repo |bzip2 |split - -b 64m >> cat *.bz2* | md5sum >dump.md5 >> >> Is there a way to do this all in one step? > > What about: > > svnadmin dump --deltas /repo | bzip2 | tee >(split -b 64m - dump.bz2.) > | md5sum > dump.md5 > > -Shad > _______________________________________________ > CentOS mailing list > CentOS at centos.org > http://lists.centos.org/mailman/listinfo/centosThis seems to work well, but I have no idea what it's doing. Can someone walk me through what tee >(split -b 64m - dump.bz2.) does and why? Russ _______________________________________________ CentOS mailing list CentOS at centos.org http://lists.centos.org/mailman/listinfo/centos ______________________________________________________________________ This e-mail, and any attachments thereto, is intended only for use by the addressee(s) named herein and may contain legally privileged and/or confidential information. If you are not the intended recipient of this e-mail, you are hereby notified that any dissemination, distribution or copying of this e-mail, and any attachments thereto, is strictly prohibited. If you have received this e-mail in error, please immediately notify the sender and permanently delete the original and any copy or printout thereof. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.centos.org/pipermail/centos/attachments/20071112/9bd5d196/attachment.html>
Ross S. W. Walker wrote:> > 'tee' splits the stdin into multiple output streams. > > The first instance of tee you listed gave it a file name and a pipe to > output the stdout to. > > The second instance did a redirection to a sub-shell which then passed > it to 'split' and it also had a pipe. > > -Ross >How does this sub-shell redirection work? Can someone explain the syntax to me or shoot me a link to a doc somewhere? Russ
Ross S. W. Walker
2007-Nov-12 23:05 UTC
[CentOS] backups and md5 all in one while splitting
Well in bash/sh the () means execute in a sub-shell. If you redirect or pipe output from one process to a command in a sub-shell it will be redirected or piped (whatever the original was) to the command being executed in the sub-shell. You can also use $(command) as a command-line variable that will substitute the output of the command during evaluation. Ie # mkinitrd /boot/initrd-$(uname -r).img $(uname -r) -Ross -----Original Message----- From: centos-bounces at centos.org <centos-bounces at centos.org> To: CentOS mailing list <centos at centos.org> Sent: Mon Nov 12 17:57:11 2007 Subject: Re: [CentOS] backups and md5 all in one while splitting Ross S. W. Walker wrote:> > 'tee' splits the stdin into multiple output streams. > > The first instance of tee you listed gave it a file name and a pipe to > output the stdout to. > > The second instance did a redirection to a sub-shell which then passed > it to 'split' and it also had a pipe. > > -Ross >How does this sub-shell redirection work? Can someone explain the syntax to me or shoot me a link to a doc somewhere? Russ _______________________________________________ CentOS mailing list CentOS at centos.org http://lists.centos.org/mailman/listinfo/centos ______________________________________________________________________ This e-mail, and any attachments thereto, is intended only for use by the addressee(s) named herein and may contain legally privileged and/or confidential information. If you are not the intended recipient of this e-mail, you are hereby notified that any dissemination, distribution or copying of this e-mail, and any attachments thereto, is strictly prohibited. If you have received this e-mail in error, please immediately notify the sender and permanently delete the original and any copy or printout thereof. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.centos.org/pipermail/centos/attachments/20071112/12334f8f/attachment.html>