Switch to xz compression (instead of bz2) to reduce the size of the huge CommModule logfiles.

pull/1/head
Wytze van der Raay 6 years ago
parent 217611ad71
commit 7757afc66d

@ -2,6 +2,9 @@
# logclean.sh - maintenance script for logfiles generated by CommModule # logclean.sh - maintenance script for logfiles generated by CommModule
# run this daily or weekly from cron # run this daily or weekly from cron
COMPRESS="xz -9 -M 1GiB" # compression program to use
COMPRESS_EXT=xz # file extension for compression program
syslog_error() syslog_error()
{ {
logger -i -t CommModule/logclean.sh -p user.err $1 logger -i -t CommModule/logclean.sh -p user.err $1
@ -31,12 +34,12 @@ if [ -n "${FILES}" ]
then then
for F in ${FILES} for F in ${FILES}
do do
syslog_notice "Compressing ${F}" && bzip2 ${F} syslog_notice "Compressing ${F}" && ${COMPRESS} ${F}
done done
fi fi
# move compressed logfiles to oldlogs directory # move compressed logfiles to oldlogs directory
FILES=`find logfile20*.txt.bz2 -print` FILES=`find logfile20*.txt.${COMPRESS_EXT} -print`
if [ -n "${FILES}" ] if [ -n "${FILES}" ]
then then
mkdir -p oldlogs mkdir -p oldlogs
@ -47,7 +50,7 @@ then
fi fi
# delete old logfiles which have not been modified in at least 2.5+ years # delete old logfiles which have not been modified in at least 2.5+ years
FILES=`find oldlogs/logfile20*.txt.bz2 -mtime +913 -print` FILES=`find oldlogs/logfile20*.txt.${COMPRESS_EXT} -mtime +913 -print`
if [ -n "${FILES}" ] if [ -n "${FILES}" ]
then then
for F in ${FILES} for F in ${FILES}

Loading…
Cancel
Save