为什么 sendmail 发送空白文本文件?

为什么 sendmail 发送空白文本文件?

我想创建一个能够通过电子邮件发送日志文件的脚本。现在的问题是,我通过电子邮件收到的文本文件是空白的。问题出在哪一部分?

MYSQL_SLOW_LOG_USER="****"
MYSQL_SLOW_LOG_PASSWORD="*****"

SLOW_LOG="/var/log/mysql-slow.log"

cat <<EOF | mysql -u $MYSQL_SLOW_LOG_USER -p$MYSQL_SLOW_LOG_PASSWORD
SET GLOBAL log_queries_not_using_indexes = 'OFF';
SET GLOBAL slow_query_log = 'OFF';
FLUSH SLOW LOGS;
EOF

cat $SLOW_LOG > /tmp/corpsoDB.txt

recipient="[email protected]"

(
cat - <<END
Subject: MySQL Slow Query Log Report-Corpso
Content-Type: multipart/mixed; boundary="-omgemailslikewhoa"

GET ON IT.

---omgemailslikewhoa
Content-Type: text/plain; name="corpsoDB.txt"
Content-Disposition: attachment; filename="corpsoDB.txt"
END

cat /tmp/corpsoDB.txt

cat <<END
---omgemailslikewhoa--

END
) | /usr/sbin/sendmail -i -- $recipient

相关内容