mirror: Print postcmd output only when running verbose

This commit is contained in:
Timo Makinen 2020-11-15 16:50:39 +00:00
parent 81dd2cbc50
commit 4f98c287ab

View file

@ -112,9 +112,15 @@ for mirror in ${SYNC} ; do
logmsg "Finished ${mirror} sync with exit status ${STATUS}${NOOP} ..."
if [ "${POSTCMD}" != "" ]; then
logmsg "Running post for ${mirror} ..."
${POSTCMD} 2>&1 | tee >( \
awk "{ print strftime(\"%Y/%m/%d %H:%M:%S\") \" [$$] \" \$0 }" \
>> "${LOGFILE}" )
if [ "${VERBOSE}" -eq 1 ]; then
${POSTCMD} 2>&1 | tee >( \
awk "{ print strftime(\"%Y/%m/%d %H:%M:%S\") \" [$$] \" \$0 }" \
>> "${LOGFILE}" )
else
${POSTCMD} 2>&1 | \
awk "{ print strftime(\"%Y/%m/%d %H:%M:%S\") \" [$$] \" \$0 }" \
>> "${LOGFILE}"
fi
logmsg "Finished post for ${mirror} ..."
fi
done