diff options
author | Dennis Eriksen <d@ennis.no> | 2020-04-20 14:27:10 +0200 |
---|---|---|
committer | Dennis Eriksen <d@ennis.no> | 2020-04-20 14:27:10 +0200 |
commit | d884ac6739126703c7df8a1bf9d07635f1d1af6c (patch) | |
tree | 2aa8e70961afcf2fdd5105d14057febce80d1c7f | |
parent | changing logging a bit (diff) | |
download | mkosibuild-d884ac6739126703c7df8a1bf9d07635f1d1af6c.tar.gz |
show all backups and sizes when run manually
-rwxr-xr-x | mkosibuild | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -57,13 +57,18 @@ function main { # Backup old machine [[ -d "${BACKUPDIR}" ]] || mkdir -p "${BACKUPDIR}" if [[ -e ".backup/${NAME}" ]]; then + TS="$(date +%Y%m%d%H%M%S)" echo "" echo "Now zipping up the old machine, for backup" cd "${BACKUPDIR}" if [[ "${CRON:=false}" = 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)" + echo "Size of original container: $(du -sh "${BACKUPDIR}/${NAME}" | awk '{print $1}')" + tar c "${NAME}" | pv -s "$(du -sb "${NAME}" | awk '{print $1}')" | xz -0 - > "${BACKUPDIR}/${NAME}.tar.xz.${TS}" + echo "Size of backup: $(du -sh "${BACKUPDIR}/${NAME}.tar.xz.${TS}" | awk '{print $1}')" + echo "All backups of ${NAME}:" + du -sh "${BACKUPDIR}/${NAME}.tar.xz"* else - tar c "${NAME}" | xz -0 - > "${BACKUPDIR}/${NAME}.tar.xz.$(date +%Y%m%d%H%M%S)${CRONSUFFIX:=-cron}" + tar c "${NAME}" | xz -0 - > "${BACKUPDIR}/${NAME}.tar.xz.${TS}${CRONSUFFIX:=-cron}" fi rm -r "${NAME}" fi |