Mise à jour de 'src/bash/filter.sh'
This commit is contained in:
parent
4c61cf5c81
commit
3ac1bec5d9
@ -73,17 +73,17 @@ ARCHIVE_TITLE="archive_content"
|
|||||||
ARCHIVE_MIME="text/kaz_email_archive"
|
ARCHIVE_MIME="text/kaz_email_archive"
|
||||||
SKIP_DEST_DOMAIN="/tmp/docker-mailserver/dest-domain-no-depol.txt"
|
SKIP_DEST_DOMAIN="/tmp/docker-mailserver/dest-domain-no-depol.txt"
|
||||||
KEEP_FAILED=true
|
KEEP_FAILED=true
|
||||||
DEBUG=
|
DEBUG=true
|
||||||
|
|
||||||
#################### FONCTIONS ############################################
|
#################### FONCTIONS ############################################
|
||||||
BOLD='[1m'
|
BOLD='[1m'
|
||||||
RED='[0;31m'
|
RED='[0;31m'
|
||||||
GREEN='[0;32m'
|
GREEN='[0;32m'
|
||||||
YELLOW='[0;33m'
|
YELLOW='[0;33m'
|
||||||
BLUE='[0;34m'
|
BLUE='[0;34m'
|
||||||
MAGENTA='[0;35m'
|
MAGENTA='[0;35m'
|
||||||
CYAN='[0;36m'
|
CYAN='[0;36m'
|
||||||
NC='[0m' # No Color
|
NC='[0m' # No Color
|
||||||
NL='
|
NL='
|
||||||
'
|
'
|
||||||
|
|
||||||
@ -142,17 +142,25 @@ get_domaine() {
|
|||||||
echo ${1/#*@/}
|
echo ${1/#*@/}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#skip_domain () {
|
||||||
|
# LEFT=":"
|
||||||
|
# for ARG in $@; do
|
||||||
|
#
|
||||||
|
#LOG_FIC "${GREEN}####################in skip domaine#################### ${ARG}"
|
||||||
|
#
|
||||||
|
# [ "${ARG}" = "--" ] && LEFT="" && continue
|
||||||
|
# DOM=$(get_domaine ${ARG})
|
||||||
|
# [ -n "${DOM}" ] || continue
|
||||||
|
# if [ -z "${LEFT}" ]; then
|
||||||
|
# grep -q "^${DOM}$" "${SKIP_DEST_DOMAIN}" 2>/dev/null && echo "yes"
|
||||||
|
# fi
|
||||||
|
# done
|
||||||
|
#}
|
||||||
|
|
||||||
skip_domain () {
|
skip_domain () {
|
||||||
LEFT=":"
|
DOM=$(get_domaine ${1})
|
||||||
for ARG in $@; do
|
grep -q ${DOM} ${SKIP_DEST_DOMAIN} 2>/dev/null && echo "yes"
|
||||||
[ "${ARG}" = "--" ] && LEFT="" && continue
|
}
|
||||||
DOM=$(get_domaine ${ARG})
|
|
||||||
[ -n "${DOM}" ] || continue
|
|
||||||
if [ -z "${LEFT}" ]; then
|
|
||||||
grep -q "^${DOM}$" "${SKIP_DEST_DOMAIN}" 2>/dev/null && echo "yes"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
#################### MAIN #################################################
|
#################### MAIN #################################################
|
||||||
echo "${NL}${BLUE}$(date +%d-%m-%Y-%H-%M-%S)${NC} : ${GREEN}######################################## filter start (log in ${TMP_LOG})${NC}" >> "${FIC_LOG}"
|
echo "${NL}${BLUE}$(date +%d-%m-%Y-%H-%M-%S)${NC} : ${GREEN}######################################## filter start (log in ${TMP_LOG})${NC}" >> "${FIC_LOG}"
|
||||||
@ -162,6 +170,7 @@ if ! mkdir -p "${MAILS}"; then
|
|||||||
LOG_FIC "${RED}Can't mkdir ${MAILS} ${NC}"
|
LOG_FIC "${RED}Can't mkdir ${MAILS} ${NC}"
|
||||||
quitFilter "${EX_UNAVAILABLE}"
|
quitFilter "${EX_UNAVAILABLE}"
|
||||||
fi
|
fi
|
||||||
|
MAIL_SOURCE_V0=$(echo $@)
|
||||||
MAIL_SOURCE=$(echo $@ | awk 'BEGIN{FS=" "} {print $2}')
|
MAIL_SOURCE=$(echo $@ | awk 'BEGIN{FS=" "} {print $2}')
|
||||||
DATE_TEMPS=$(date "+%Y-%m-%d-%H:%M:%S")
|
DATE_TEMPS=$(date "+%Y-%m-%d-%H:%M:%S")
|
||||||
REP_PIECE_JOINTE="${MAILS}/${DATE_TEMPS}_${MAIL_SOURCE}_$$"
|
REP_PIECE_JOINTE="${MAILS}/${DATE_TEMPS}_${MAIL_SOURCE}_$$"
|
||||||
@ -174,11 +183,12 @@ PERIOD=$(curl "${JIRAFEAU_LOCAL}/a.php?p=${MAIL_SOURCE}" 2>/dev/null )
|
|||||||
[[ "${PERIOD}" =~ ^(minute|hour|day|week|month|quarter)$ ]] || PERIOD="${DEFAULT_PERIOD}"
|
[[ "${PERIOD}" =~ ^(minute|hour|day|week|month|quarter)$ ]] || PERIOD="${DEFAULT_PERIOD}"
|
||||||
|
|
||||||
LOG_FIC "${NL}" \
|
LOG_FIC "${NL}" \
|
||||||
" MAIL_SOURCE : ${YELLOW}${MAIL_SOURCE}${NC}${NL}" \
|
" MAIL_SOURCE : ${YELLOW}${MAIL_SOURCE}${NC}${NL}" \
|
||||||
" DATE_TEMPS : ${YELLOW}${DATE_TEMPS=}${NC}${NL}" \
|
" MAIL_SOURCE_V0 : ${YELLOW}${MAIL_SOURCE_V0}${NC}${NL}" \
|
||||||
" MODE : ${YELLOW}${MODE}${NC}${NL}" \
|
" DATE_TEMPS : ${YELLOW}${DATE_TEMPS=}${NC}${NL}" \
|
||||||
" TRACK : ${YELLOW}${TRACK}${NC}${NL}" \
|
" MODE : ${YELLOW}${MODE}${NC}${NL}" \
|
||||||
" PERIOD : ${YELLOW}${PERIOD}${NC}${NL}"
|
" TRACK : ${YELLOW}${TRACK}${NC}${NL}" \
|
||||||
|
" PERIOD : ${YELLOW}${PERIOD}${NC}${NL}"
|
||||||
|
|
||||||
if ! cd "${INSPECT_DIR}"; then
|
if ! cd "${INSPECT_DIR}"; then
|
||||||
echo "${INSPECT_DIR} does not exist"
|
echo "${INSPECT_DIR} does not exist"
|
||||||
@ -217,7 +227,7 @@ if [ "${MODE}" = "none"]; then
|
|||||||
quitFilter 0
|
quitFilter 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$(skip_domain $*)" = "yes"]; then
|
if [ "$(skip_domain ${MAIL_SOURCE})" = "yes" ]; then
|
||||||
LOG_FIC " - ${GREEN}send without change (skip domain)${NC}"
|
LOG_FIC " - ${GREEN}send without change (skip domain)${NC}"
|
||||||
${SENDMAIL} "$@" < "${INSPECT_DIR}/in.$$"
|
${SENDMAIL} "$@" < "${INSPECT_DIR}/in.$$"
|
||||||
quitFilter 0
|
quitFilter 0
|
||||||
|
Loading…
Reference in New Issue
Block a user