question about piping and standard output



Hi,

As part of a backup scheme, I use the dump program to create weekly
level 0 dumps to a disk. These dump files end up being huge, larger
than 2 gb, so I use split to split them down to 2 gb, so the command
goes something like:

dump -0 -a -u -f - /dev/sda1 | split -b2000m - foo.dump

It creates several 2 gb files such as foo.dumpaa, foo.dumpab, ...
resulting from the split command.

The question is, how can I also include tar and gzip in this command
line to tar and gzip the split'd files?

I'm not familiar enough with how shell variables, pipes, and redirects
work to make this combination happen as I want. I could make a script
to plow through the files after the dump is done. It seems more
'elegant' to do it on one line -- because linux is all about elegance.

I would like for the files to have the .tgz or .tar.gz extension
(i.e., foo.dumpaa -> foo.dumpaa.tgz).

specs: running Redhate 7.x, kernel version: 2.4.20-43.7.legacysmp,
tar (GNU tar) 1.15.1, split (coreutils) 5.2.1, gzip 1.3.5, dump 0.4b40
(using libext2fs 1.37 of 21-Mar-2005)

Regards,
-Ben

.



Relevant Pages