From 56dbd9d14e01fc4e4d4987a047f952ffa57f7777 Mon Sep 17 00:00:00 2001 From: William Harrington Date: Mon, 5 Apr 2021 20:28:05 -0500 Subject: Make tar command verbose and log to backup and cleanup logs. --- chapter6/backup.sh | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'chapter6/backup.sh') diff --git a/chapter6/backup.sh b/chapter6/backup.sh index ed46f31..15a26c9 100644 --- a/chapter6/backup.sh +++ b/chapter6/backup.sh @@ -9,17 +9,17 @@ else printf "%b" "${GRN}Backing up ${YLW}${LFS}${GRN} to ${YLW}${file}${RST}... " pushd "${LFS}" > /dev/null || exit 1 - sudo XZ_OPTS="-T${NUMPROCS} -e" tar cJpf "${HOME}"/"${file}" "${directories[@]}" >/dev/null 2>&1 & pid=$! - spinner "$pid" "${SPINNER}" - retval=$? - if [ "$retval" -ne 0 ]; then - printf "%b" "${IRED}FAILED!${RST}\n" - exit "${retval}" - else - sudo chown "${USER}" "${HOME}"/"${file}" - printf "%b" "${IGRN}OK${RST}\n" - fi + sudo XZ_OPTS="-T${NUMPROCS} -e" tar cJvpf "${HOME}"/"${file}" "${directories[@]}" >/"${LFS}"/sources/log/chapter6/backup.log 2>&1 & pid=$! + spinner "$pid" "${SPINNER}" + retval=$? + if [ "$retval" -ne 0 ]; then + printf "%b" "${IRED}FAILED!${RST}\n" + exit "${retval}" + else + sudo chown -v "${USER}" "${HOME}"/"${file}" >>"${LFS}"/sources/log/chapter6/backup.log + printf "%b" "${IGRN}OK${RST}\n" + fi popd > /dev/null || exit 1 - touch "${LFS}/sources/chapter6/backup" + touch "${LFS}"/sources/chapter6/backup fi -- cgit v1.2.3-54-g00ecf