33 lines
594 B
Bash
Executable File
33 lines
594 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
SWIFT="swift -A http://kvm01.int.lan:7480/auth/v2.0 -U mx:spam -K o99CuKcfmj31i2UumqB3h8Fh1K0T2bFBO2snbYpk"
|
|
|
|
BDIR="/var/spool/vmail_imapsieve_copy"
|
|
|
|
#run only if there is stuff in the dir
|
|
|
|
SIZE=$(du -sb ${BDIR} |cut -f1)
|
|
[[ ${SIZE} -lt 12289 ]] && exit 0
|
|
|
|
cd $BDIR
|
|
|
|
remove_files () {
|
|
if [[ $2 -eq 0 ]]; then
|
|
rm -f $1/*
|
|
fi
|
|
}
|
|
|
|
#we have data, upload
|
|
ls ham/*.eml 1>/dev/null 2>&1
|
|
if [[ $? -eq 0 ]]; then
|
|
${SWIFT} upload mailing ham
|
|
remove_files ham $?
|
|
fi
|
|
ls spam/*.eml 1>/dev/null 2>&1
|
|
if [[ $? -eq 0 ]]; then
|
|
${SWIFT} upload mailing spam
|
|
remove_files spam $?
|
|
fi
|
|
|
|
|