How to get verbose progress updates but also log with "tee"

Hi

When I run restic from terminal with --verbose I get a nice running update with the time elapsed and the files/size processed so far; its great to tell how far restic is from finishing.

When I run the same command in a script with “tee” to log the output I no longer get the progress bar. I dont want the progress bar updates in the log file but having it come out on terminal would be handy.

My ultimate intention is to have the script run in a cron job (where progress bar not needed) but also from time to time running interactively so having the progress bar is important to see if restic is still alive/working

Is there a way to get this desired behaviour?

Hi @kellytrinh,

As far as I know restic only shows progress if output is a tty.

If on Linux you could use script tool to workaround this issue:

script -q -c "here your restic command" | tee /path/to/logfile

Then you will see the progress and you get a log. Keep in mind that in the log there will be a lot of “progress garbage” so if you want to get a clean logfile, once restic command ends:

cat /path/to/logfile > /path/to/logfile-without-progress-garbage

Unfortunately, the script tool solution won’t work if you don’t run it in a tty so if you plan to use cron it won’t work (at least in the test I did a few minutes ago).

The ideal is that restic, in a non tty execution, would write only 1%, 5%, 10% progress or something like that to output so we could check what is the backup progress.

There is an open issue regarding this subject Periodically print progress information when output device is not TTY · Issue #2265 · restic/restic · GitHub but I’m afraid it didn’t receive any attention.

I hope someone else could give a solution to this issue (I’m interested too :wink: ).

1 Like