add more verbosity
This commit is contained in:
parent
1d69db0356
commit
bd08bac175
@ -37,6 +37,8 @@ BASEDIR=$(readlink -f $(dirname "$0")/../../..)
|
|||||||
BACKUPDIR=${BASEDIR}/backup/var/
|
BACKUPDIR=${BASEDIR}/backup/var/
|
||||||
CONFDIR=$BASEDIR/backup/
|
CONFDIR=$BASEDIR/backup/
|
||||||
|
|
||||||
|
[[ -z ${isSilent} || -v ${verboseOption} ]] && echo -e "\e[32mstarted\e[0m"
|
||||||
|
|
||||||
if [ ! -d "$BACKUPDIR" ]; then
|
if [ ! -d "$BACKUPDIR" ]; then
|
||||||
[[ -z ${isSilent} || -v ${verboseOption} ]] && echo -e "\e[36mcreate backup directory ${BACKUPDIR}\e[0m"
|
[[ -z ${isSilent} || -v ${verboseOption} ]] && echo -e "\e[36mcreate backup directory ${BACKUPDIR}\e[0m"
|
||||||
mkdir -p ${verboseOption} "${BACKUPDIR}"
|
mkdir -p ${verboseOption} "${BACKUPDIR}"
|
||||||
@ -52,10 +54,12 @@ cd ${BASEDIR}
|
|||||||
tar --numeric-owner ${verboseOption} -cf backup/var/new.tar var
|
tar --numeric-owner ${verboseOption} -cf backup/var/new.tar var
|
||||||
|
|
||||||
if [ ! -f "${BACKUPDIR}latest.tar" ] || [ "$(cmp ${BACKUPDIR}latest.tar ${BACKUPDIR}new.tar)" ]; then
|
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 && \
|
cp ${verboseOption} ${BACKUPDIR}new.tar ${BACKUPDIR}latest.tar && \
|
||||||
mv ${verboseOption} ${BACKUPDIR}new.tar ${BACKUPDIR}var.tar && \
|
mv ${verboseOption} ${BACKUPDIR}new.tar ${BACKUPDIR}var.tar && \
|
||||||
/usr/sbin/logrotate ${verboseOption} -fs ${CONFDIR}rotatemap_var.state ${CONFDIR}rotatemap_var.conf
|
/usr/sbin/logrotate ${verboseOption} -fs ${CONFDIR}rotatemap_var.state ${CONFDIR}rotatemap_var.conf
|
||||||
else
|
else
|
||||||
|
[[ -z ${isSilent} || -v ${verboseOption} ]] && echo -e "\e[36mdiscard unchanged\e[0m"
|
||||||
rm ${verboseOption} ${BACKUPDIR}new.tar
|
rm ${verboseOption} ${BACKUPDIR}new.tar
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user