maildir-last-change.sh: fix error, if domain is given at commandline.

This commit is contained in:
Christoph 2019-08-04 14:22:20 +02:00
parent 62b6118d66
commit 616cfd8eee

View File

@ -277,6 +277,25 @@ else
echo_skipped echo_skipped
fi fi
echononl "Remove old statistic files .."
if [[ "$DOMAIN" = "*" ]] ; then
rm -f ${DST_DIR}/* > $error_log 2>&1
if [[ $? -eq 0 ]]; then
echo_done
else
echo_failed
error "$(cat "$error_log")"
fi
else
rm -f "${DST_DIR}/${DOMAIN}/*"
if [[ $? -eq 0 ]]; then
echo_done
else
echo_failed
error "$(cat "$error_log")"
fi
fi
echononl "Determin last change time for mailboxes.." echononl "Determin last change time for mailboxes.."
echo_wait echo_wait
@ -311,7 +330,11 @@ echononl "Write down statistic files per domain .."
echo_wait echo_wait
_failed=false _failed=false
for _domain in "${_domain_arr[@]}" ; do for _domain in "${_domain_arr[@]}" ; do
cat "${DST_DIR}/00-all-domains.stat" | grep "@$_domain" > "${DST_DIR}/${_domain}.stat" 2> "$error_log" if [[ ${#_domain_arr[@]} -eq 1 ]] ; then
cat $_CACHE_FILE | sort -n > "${DST_DIR}/${_domain}.stat" 2> "$error_log"
else
cat "${DST_DIR}/00-all-domains.stat" | grep "@$_domain" > "${DST_DIR}/${_domain}.stat" 2> "$error_log"
fi
if [[ $? -ne 0 ]]; then if [[ $? -ne 0 ]]; then
_failed=true _failed=true
fi fi