exit 5
fi
+MY_LOG_DIR="${HOSTS_DIR}/zzz_cleanup_hostlogs"
+if [[ ! -d "${MY_LOG_DIR}" ]] ; then
+ mkdir -m 0755 -p "${MY_LOG_DIR}"
+fi
+
+i=0
+MY_LOG="${MY_LOG_DIR}/cleanup.$( date +'%Y-%m-%d' ).${i}.log"
+ERR_LOG="${MY_LOG_DIR}/cleanup.$( date +'%Y-%m-%d' ).${i}.error.log"
+while [[ -e "${MY_LOG}" || -e "${ERR_LOG}" ]] ; do
+ i=$(( $i + 1 ))
+ MY_LOG="${MY_LOG_DIR}/cleanup.$( date +'%Y-%m-%d' ).${i}.log"
+ ERR_LOG="${MY_LOG_DIR}/cleanup.$( date +'%Y-%m-%d' ).${i}.error.log"
+done
+
+exec >> "${MY_LOG}" 2>> "${ERR_LOG}"
+
CUR_YEAR=$( date +'%Y' )
CUR_MONTH=$( date +'%m' )
echo
echo "[$( my_date )]: Compressing files older than ${MIN_AGE_COMPRESS} days:"
for fname in $( find "${HOSTS_DIR}" -type f -mtime +${MIN_AGE_COMPRESS} | \
- grep -vi '\.gz$' | head -n 1000 ) ; do
+ grep -vi '\.gz$' | head -n 10000 ) ; do
if [[ -f "${fname}" ]] ; then
echo " * '${fname}'"
ls -l "${fname}"
- gzip -v9 "${fname}"
+ gzip -9 "${fname}"
ls -l "${fname}"*
COMPRESSED_FILES=$(( $COMPRESSED_FILES + 1 ))
fi