Script:Resume a tar (and gzip)

I was compressing a huge text file into a tar.gz while doing about 10 other things this morning when my computer froze up. I desperately tried to get into the system monitor application and switching desktops (ctrl+alt+F5) with no luck. I had to actually use the power button 😦

7GB has already been written and I didn’t want to start over, so I just created this script to resume the creation of tar files.


if [ $# -eq 0 ]; then
SIZE=”$(wc -c < $OUTFILE)”
tar -cvvz –to-stdout “$INFILES” | tail -c +$(($SIZE+1)) >> “$OUTFILE”

echo “${OUTFILE} creation completed!”

It seems to have worked just fine. I can’t see any errors in the file, but it was simply a large CSV. Give it a shot with different file types and report your successes and failures in the comments!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s