Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Long running tar command



On Fri, Sep 27, 2024 at 07:10:16PM -0700, Bart Schaefer wrote:
> On Fri, Sep 27, 2024 at 6:38???PM Dominik Vogt <dominik.vogt@xxxxxx> wrote:
> >
> >   tar c -v -f >(tee dest.tar | md5sum > dest.md5) /data > dest.list
> >
> > I'd also like to use the --verify tar option, but that does not
> > work because ">(...)" is not a seekable file descriptor.  Any idea
> > how to get around this limitation?
>
> The --verify pass won't happen until the output file is fully written,
> so is it really slower to run a second tar command to do that?

I don't think it's slower, but tar has no way of verifying an
already existing archive.  --verify works only with "tar -c".
(And it's unclear what --verify does in the first place because it
does _not_ compare file contents.  Maybe it's equivalent to a
separate "tar -t".)

> That said, if you're on Linux / using modern GNU tools, you could do:
>
> : assure dest.tar exists and is empty >! dest.tar
> tar c -v -f --verify dest.tar /data > dest.list & tail -f --pid=$!
> dest.tar | md5sum > dest.md5

Great.  I was already thinking about how a separate process could
detect that tar was finished writing the archive and wasn't aware
of the --pid option.  A litte more tweaking is necessary to make
sure "dest.tar" already exists when tail is executed:

  tar -c ... -f dest.tar ... & sleep 1; tail ...

Ciao

Dominik ^_^  ^_^

--

Dominik Vogt




Messages sorted by: Reverse Date, Date, Thread, Author