![](/img/trans.png)
[英]adding the .txt file's content in the body of the message in the mail of mailx command in linux
[英]Include Log file content in mailx body
下面的腳本發送郵件並且正在工作。 如何在其中包含/var/backup/log
存在的日志文件的內容?
echo "Below are the files copied during RUN" | mailx -v \
-r "network@testserver.com" \
-s "Backup Summary" \
-S smtp="smtp.testserver.com:25" \
me@myhome.com
也許是這樣的:( 編輯以刪除不可打印的字符)
(echo "Below are the files copied during RUN" && echo -e "\n----- somelogfile -----\n" && cat /var/backup/log/somelogfile) | tr -dc '[[:print:]]' | mailx -v \
-r "network@testserver.com" \
-s "Backup Summary" \
-S smtp="smtp.testserver.com:25" \
me@myhome.com
該解決方案會將日志文件的內容附加在郵件正文中(第二個“ echo”僅用於在郵件中添加引用)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.