add more verbosity

This commit is contained in:
Daniel Seifert 2025-01-30 09:02:00 +01:00
parent 1d69db0356
commit bd08bac175

View File

@ -37,6 +37,8 @@ BASEDIR=$(readlink -f $(dirname "$0")/../../..)
BACKUPDIR=${BASEDIR}/backup/var/
CONFDIR=$BASEDIR/backup/
[[ -z ${isSilent} || -v ${verboseOption} ]] && echo -e "\e[32mstarted\e[0m"
if [ ! -d "$BACKUPDIR" ]; then
[[ -z ${isSilent} || -v ${verboseOption} ]] && echo -e "\e[36mcreate backup directory ${BACKUPDIR}\e[0m"
mkdir -p ${verboseOption} "${BACKUPDIR}"
@ -52,10 +54,12 @@ cd ${BASEDIR}
tar --numeric-owner ${verboseOption} -cf backup/var/new.tar var
if [ ! -f "${BACKUPDIR}latest.tar" ] || [ "$(cmp ${BACKUPDIR}latest.tar ${BACKUPDIR}new.tar)" ]; then
[[ -z ${isSilent} || -v ${verboseOption} ]] && echo -e "\e[36madd to backup\e[0m"
cp ${verboseOption} ${BACKUPDIR}new.tar ${BACKUPDIR}latest.tar && \
mv ${verboseOption} ${BACKUPDIR}new.tar ${BACKUPDIR}var.tar && \
/usr/sbin/logrotate ${verboseOption} -fs ${CONFDIR}rotatemap_var.state ${CONFDIR}rotatemap_var.conf
else
[[ -z ${isSilent} || -v ${verboseOption} ]] && echo -e "\e[36mdiscard unchanged\e[0m"
rm ${verboseOption} ${BACKUPDIR}new.tar
fi