From d8140ae4ccdd4afb7b57006091233d7c8aaf15ed Mon Sep 17 00:00:00 2001 From: Dennis Eriksen Date: Fri, 3 Apr 2020 10:10:46 +0200 Subject: adding pv progress to the backupjob --- mkosibuild | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mkosibuild b/mkosibuild index 2de32f3..860c538 100755 --- a/mkosibuild +++ b/mkosibuild @@ -77,7 +77,11 @@ function main { echo "" echo "Now zipping up the old machine, for backup" cd "${BACKUPDIR}" - tar c "${NAME}" | xz -0 - > "${BACKUPDIR}/${NAME}.tar.xz.$(date +%Y%m%d%H%M%S)${SUFFIX}" + if [[ ${CRON} = false ]] && [[ -x "$(command -v pv)" ]]; then + tar c "${NAME}" | pv -s "$(du -sb "${NAME}" | awk '{print $1}')" | xz -0 - > "${BACKUPDIR}/${NAME}.tar.xz.$(date +%Y%m%d%H%M%S)${SUFFIX}" + else + tar c "${NAME}" | xz -0 - > "${BACKUPDIR}/${NAME}.tar.xz.$(date +%Y%m%d%H%M%S)${SUFFIX}" + fi rm -r "${NAME}" # Delete old backups -- cgit v1.2.3