diff options
author | Dennis Eriksen <d@ennis.no> | 2020-04-03 10:10:46 +0200 |
---|---|---|
committer | Dennis Eriksen <d@ennis.no> | 2020-04-03 10:10:46 +0200 |
commit | d8140ae4ccdd4afb7b57006091233d7c8aaf15ed (patch) | |
tree | 877a4eed5349c8c0f57a7dfa96f0b2d7df5b5409 | |
parent | contiguing work. In time I want to be able to run this in cron (diff) | |
download | mkosibuild-d8140ae4ccdd4afb7b57006091233d7c8aaf15ed.tar.gz |
adding pv progress to the backupjob
-rwxr-xr-x | mkosibuild | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -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 |