Rotate cronscripts logs

Configurable per variable (override in local vars file), we keep (by
default) only 60 days
上级 59ce1ca8
......@@ -35,6 +35,9 @@ PATH=${masterdir}:${PATH}
# By default, add no timestamps to stage logs
TIMESTAMP=false
# How many days of logfiles to keep?
declare -r logkeep=${logkeep:-60}
declare -r HOSTNAME=$(hostname -s)
# where do we want mails to go? For example log entries made with error()
......
......@@ -287,6 +287,9 @@ function laststeps() {
# and ensure its no longer used
exec > "$logdir/after${PROGRAM}.log" 2>&1
# Rotate out old logfiles
find ${logdir}/${PROGRAM}_*.log.bz2 -mtime +${logkeep} -delete
# Now, at the very (successful) end of this run, make sure we remove
# our stage files, so the next script run will do it all again.
if [[ ${successval} -eq 0 ]]; then
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册