diff options
author | Dennis Eriksen <dennis@terje.dnns.no> | 2019-02-09 14:57:49 +0100 |
---|---|---|
committer | Dennis Eriksen <dennis@terje.dnns.no> | 2019-02-09 14:57:49 +0100 |
commit | f4c4bf8b154c8be654ff36900137a79687871393 (patch) | |
tree | 57ab2f656a81da324dc8706f1bf15dad11e5645c | |
parent | initial commit (diff) | |
download | eximstats-cron-f4c4bf8b154c8be654ff36900137a79687871393.tar.gz |
moving wildcard for globbing out of quotes
-rwxr-xr-x | eximstats-cron | 16 |
1 files 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 |