In need of a bit of shellish magic

Chip Marshall chip at 2bithacker.net
Fri Jun 2 16:26:02 EDT 2006


On June 02, 2006, Ted Roche sent me the following:
> I've just put a subversion repository on line and would like to make  
> daily backups of it. That's pretty easy, a cron job at 2 AM with:
> 
> svnadmin dump /path/to/repos >svndump20060602
> 
> However, it would be convenient if the file name incremented year  
> month and day automatically. Is there a built in bash feature to  
> create a file name like that or should I look at a perl/python script?
> 
> For extra points, what's the magic to pipe it through tar? I tried >  
> and | followed by tar -czf svndump20060602.tgz, but just haven't  
> grokked piping yet, apparently.

I think you should be able to do something like:
  svnadmin dump /path/to/repos > svndump`date +%Y%m%d`

As for piping through tar, I don't quite get the idea here, since it's
not a collection of files, it's just a stream of bytes. It would be
easy enough to compress it by doing:
  svnadmin dump /path/to/repos | gzip > svndump`date +%Y%m%d`.gz

-- 
Chip Marshall <chip at 2bithacker.net>     http://kyzoku.2bithacker.net/
GCM/IT d+(-) s+:++ a24>? C++ UB++++$ P+++$ L- E--- W++ N@ o K- w O M+
V-- PS+ PE Y+ PGP++ t+@ R@ tv@ b++@ DI++++ D+(-) G++ e>++ h>++ r-- y?



More information about the gnhlug-discuss mailing list