aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDennis Eriksen <d@ennis.no>2020-04-03 10:10:46 +0200
committerDennis Eriksen <d@ennis.no>2020-04-03 10:10:46 +0200
commitd8140ae4ccdd4afb7b57006091233d7c8aaf15ed (patch)
tree877a4eed5349c8c0f57a7dfa96f0b2d7df5b5409
parentcontiguing work. In time I want to be able to run this in cron (diff)
downloadmkosibuild-d8140ae4ccdd4afb7b57006091233d7c8aaf15ed.tar.gz
adding pv progress to the backupjob
-rwxr-xr-xmkosibuild6
1 files changed, 5 insertions, 1 deletions
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