From f4c4bf8b154c8be654ff36900137a79687871393 Mon Sep 17 00:00:00 2001 From: Dennis Eriksen Date: Sat, 9 Feb 2019 14:57:49 +0100 Subject: moving wildcard for globbing out of quotes --- eximstats-cron | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/eximstats-cron b/eximstats-cron index f5d8d98..496c9f3 100755 --- a/eximstats-cron +++ b/eximstats-cron @@ -19,14 +19,14 @@ daily="${STATDIR}/"$(date --date '-1 day' "+%Y/%m/%d.html") eximstats -html="${daily}" /var/log/exim4/mainlog-$(date --date '-1 day' "+%Y%m%d") folder="${STATDIR}/yesterday" -[ -d "${folder}" ] && rm -f "${folder}/*" || mkdir "${folder}" +[ -d "${folder}" ] && rm -f "${folder}"/* || mkdir "${folder}" cd "${folder}" eximstats -charts -html="index.html" /var/log/exim4/mainlog-$(date --date '-1 day' "+%Y%m%d") function stats_for_last_n_days () { folder="${STATDIR}/last ${1} days" - [ -d "${folder}" ] && rm -f "${folder}/*" || mkdir "${folder}" + [ -d "${folder}" ] && rm -f "${folder}"/* || mkdir "${folder}" cd "${folder}" files="" @@ -50,28 +50,28 @@ stats_for_last_n_days 30 # update this months total folder="${STATDIR}/"$(date "+%Y/%m/total") -[ -d "${folder}" ] && rm -f "${folder}/*" || mkdir "${folder}" +[ -d "${folder}" ] && rm -f "${folder}"/* || mkdir "${folder}" cd "${folder}" eximstats -charts -merge -html="index.html" ../*.html # If it's the first of the month, do monthly total for last month. # Also, we update the total for the year. -if [ $(date '+%d') -eq 1 ]; then +if [ $(date '+%d') == 01 ]; then # Monthly folder="${STATDIR}/"$(date --date '-1 day' "+%Y/%m/total") - [ -d "${folder}" ] && rm -f "${folder}/*" || mkdir "${folder}" + [ -d "${folder}" ] && rm -f "${folder}"/* || mkdir "${folder}" cd "${folder}" eximstats -charts -merge -html="index.html" ../*.html # Yearly folder="${STATDIR}/"$(date --date '-1 day' "+%Y/total") - [ -d "${folder}" ] && rm -f "${folder}/*" || mkdir "${folder}" + [ -d "${folder}" ] && rm -f "${folder}"/* || mkdir "${folder}" cd "${folder}" eximstats -charts -merge -html="index.html" ../[0-1][0-9]/*.html # GRAND TOTAL folder="${STATDIR}/total" - [ -d "${folder}" ] && rm -f "${folder}/*" || mkdir "${folder}" - cd ${folder} + [ -d "${folder}" ] && rm -f "${folder}"/* || mkdir "${folder}" + cd "${folder}" eximstats -charts -merge -html="index.html" ../20[0-9][0-9]/[0-1][0-9]/*.html fi -- cgit v1.2.3