1
I would like to create a progress bar for my backup script. The problem is that the rsync command (which is inside the loop) generates duplicate (unnecessary) lines that increase the size of the log file. I already included inside the loop the command uniq -u
to generate single lines, but this command causes a bug in the dialog progress bar (hangs the bar). See a snippet of my code below.
dialog --infobox 'Iniciando Backup...' 3 25; sleep 1
declare -i cont=1
{
while [ $cont -le 100 ]; do
echo $cont
cont=$((cont+1))
rsync -avh --progress "/home/$USER/Documentos" "/home/$USER/Backup/" --log-file=arquivo.log
uniq -u arquivo.log
done
} | dialog --gauge 'Aguarde... Copiando Arquivos' 8 70 0
dialog --msgbox 'Backup concluído com sucesso!' 6 35
dialog --title 'Log de Backup' --textbox "$ARQUIVO_LOG" 0 0
I don’t know how to fix this, would anyone know how to perfect this code? Please test this code and propose improvements. Thanks in advance.