3

enter image description hereCan I see a progress bar or something not only ust the terminal screen output while backing up?

Here is my shell script that I used backup with tar command:

# !/bin/bash

 DATEJOUR=$(date +"%Y-%m-%d-%H-%M-%S")
 REPABACKUPER="--exclude=/home/(username)/myfolders \
 --exclude=/home/(username)/backup                  \
 --exclude=/proc                                    \
 --exclude=/lost+found                              \
 --exclude=/mnt                                     \
 --exclude=/media                                   \
 --exclude=/sys /"
 REPBACKUP="/home/(username)/backup"
 NOMFIC=$REPBACKUP/Pavilion_backup-$DATEJOUR.tar.bz2

 sudo tar cvpjf $NOMFIC $REPABACKUPER


 exit $?
John
  • 31

3 Answers3

4

pipebench shows running time, data processed and speed:

tar -cj --exclude=filename source_dir | pipebench >dest.tar.bz2
Graeme
  • 34,027
3

That's what I use for backup, the progress bar is powered by pv command

tar cf - . --exclude=backup --exclude=$file | pv -s `du -sb . | grep -o '[0-9]\+'` -N tar  | gzip > $file

du -sb . | grep -o '[0-9]\+' this part is responsible for getting 100% in your progress bar

Lesmana
  • 27,439
baldrs
  • 130
  • 1
    Your tar is using compression, so du isn't going to tell how much data it has to write. (take the z off and pipe to gzip) – Ricky Jan 27 '14 at 08:37
0

Not possible. tar doesn't know how much data it has to work with until it's done with it. Unlike rsync, it does not scan the source tree before processing.

(During extraction, it's possible, but I don't know any versions of tar that bothers.)

Ricky
  • 1,377