mirror of
https://github.com/EDCD/EDDN.git
synced 2025-06-16 15:22:06 +03:00
contrib/eddn-logs-archive: Run gateway error report script on gateway.log
* Renamed some variables to be truer to their content and use. * Run eddn-report-log-errors if rotating a gateway.log file.
This commit is contained in:
parent
a1e330be2c
commit
3ffff54c4b
@ -87,8 +87,9 @@ do
|
|||||||
log " Archiving ${service}.log ..."
|
log " Archiving ${service}.log ..."
|
||||||
# We have no means to tell the service to close and re-open output, it's
|
# We have no means to tell the service to close and re-open output, it's
|
||||||
# to stdout/err anyway. So we copy it.
|
# to stdout/err anyway. So we copy it.
|
||||||
COMPRESSED_NAME="${service}.log.$(date --iso-8601=seconds)"
|
TIMESTAMP="$(date --iso-8601=seconds)"
|
||||||
cp ${service}.log "${COMPRESSED_NAME}"
|
ARCHIVED_NAME="${service}.log.${TIMESTAMP}"
|
||||||
|
cp ${service}.log "${ARCHIVED_NAME}"
|
||||||
if [ $? -ne 0 ];
|
if [ $? -ne 0 ];
|
||||||
then
|
then
|
||||||
echo " FAILED copying live log file to new archive!!!" >&2
|
echo " FAILED copying live log file to new archive!!!" >&2
|
||||||
@ -97,8 +98,15 @@ do
|
|||||||
fi
|
fi
|
||||||
# Truncate the live file.
|
# Truncate the live file.
|
||||||
:> ${service}.log
|
:> ${service}.log
|
||||||
|
|
||||||
|
if [ "${service}" == "gateway" ];
|
||||||
|
then
|
||||||
|
# Produce a report of interesting errors
|
||||||
|
${HOME}/.local/bin/eddn-report-log-errors "${ARCHIVED_NAME}" > "${HOME}/reports/eddn-errors/by-log-rotation/eddn-errors-${TIMESTAMP}.txt"
|
||||||
|
fi
|
||||||
|
|
||||||
# Now compress the newly archived log
|
# Now compress the newly archived log
|
||||||
gzip -9v "${COMPRESSED_NAME}"
|
gzip -9v "${ARCHIVED_NAME}"
|
||||||
log " DONE"
|
log " DONE"
|
||||||
else
|
else
|
||||||
log " No"
|
log " No"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user