sudo apt-get install logcheck設定要把log寄到你的信箱
sudo vim /etc/logcheck/logcheck.conf內容修改:
... SENDMAILTO="xxxxxx@gmail.com" ...測試是否可以把log寄到信箱
sudo -u logcheck logcheck
二、msmtp 安裝
sudo apt-get install msmtp將msmtp 寄件者改成gmail,內容如下:
sudo vim /etc/msmtprc
account gmail account default: gmail host smtp.gmail.com from xxxxxx@gmail.com protocol smtp tls on auth on port 587 user xxxxxx@gmail.com password xxooxx logfile /var/log/msmtp.log tls_starttls on tls_certcheck off測試msmtp寄mail
echo "Test from msmtp" | msmtp xxxxxx@gmail.com將logcheck寄信功能改成msmtp來寄
sudo ln -s /usr/bin/msmtp /usr/local/sbin/sendmail
sudo ln -s /usr/bin/msmtp /usr/local/bin/sendmail測試是否可以寄信
echo -e "Subject: I hope I receive this\nTest from sendmail" | sendmail xxxxxx@gmail.com
參考鍵結:http://nixnote.blogspot.tw/2013/10/configuring-logcheck-on-ubuntu.html
沒有留言:
張貼留言