scripts: update log format (#4035)

Co-authored-by: Brennan Kinney <5098581+polarathene@users.noreply.github.com>
This commit is contained in:
Georg Lauterbach 2024-05-29 02:28:51 +02:00 committed by GitHub
parent 95d965fb76
commit f8b3f40276
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 40 additions and 36 deletions

View file

@ -10,8 +10,8 @@ CHANGELOG_URL='https://github.com/docker-mailserver/docker-mailserver/blob/maste
# check for correct syntax
# number + suffix. suffix must be 's' for seconds, 'm' for minutes, 'h' for hours or 'd' for days.
if [[ ! ${UPDATE_CHECK_INTERVAL} =~ ^[0-9]+[smhd]{1}$ ]]; then
_log_with_date 'warn' "Invalid 'UPDATE_CHECK_INTERVAL' value '${UPDATE_CHECK_INTERVAL}'"
_log_with_date 'warn' 'Falling back to daily update checks'
_log 'warn' "Invalid 'UPDATE_CHECK_INTERVAL' value '${UPDATE_CHECK_INTERVAL}'"
_log 'warn' 'Falling back to daily update checks'
UPDATE_CHECK_INTERVAL='1d'
fi
@ -22,7 +22,7 @@ while true; do
# did we get a valid response?
if [[ ${LATEST} =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
_log_with_date 'debug' 'Remote version information fetched'
_log 'debug' 'Remote version information fetched'
# compare versions
if dpkg --compare-versions "${VERSION}" lt "${LATEST}"; then
@ -38,15 +38,15 @@ Latest version: ${LATEST}
Changelog: ${CHANGELOG_URL}#END
EOF
_log_with_date 'info' "Update available [ ${VERSION} --> ${LATEST} ]"
_log 'info' "Update available [ ${VERSION} --> ${LATEST} ]"
# only notify once
echo "${MAIL}" | mail -s "Mailserver update available! [ ${VERSION} --> ${LATEST} ]" "${POSTMASTER_ADDRESS}" && exit 0
else
_log_with_date 'info' 'No update available'
_log 'info' 'No update available'
fi
else
_log_with_date 'warn' 'Update check failed'
_log 'warn' 'Update check failed'
fi
# check again in 'UPDATE_CHECK_INTERVAL' time