安裝 logwatch
# emerge –ask logwatch
These are the packages that would be merged, in order:
Calculating dependencies… done!
[ebuild N ] dev-perl/Carp-Clan-6.40.0-r1 USE=”{-test}”
[ebuild N ] dev-perl/Sys-CPU-0.540.0-r1
[ebuild N ] dev-perl/Sys-MemInfo-0.910.0-r1
[ebuild N ] virtual/mailx-1
[ebuild N ] virtual/cron-0
[ebuild N ] dev-perl/DateManip-6.410.0 USE=”{-test}”
[ebuild N ] dev-perl/Tie-IxHash-1.230.0 USE=”{-test}”
[ebuild N ] dev-perl/Bit-Vector-7.200.0-r1
[ebuild N ] dev-perl/Date-Calc-6.300.0-r1
[ebuild N ] sys-apps/logwatch-7.4.0_p170-r1
Would you like to merge these packages? [Yes/No]y[@more@]1. 備份原設定檔 /usr/share/logwatch/default.conf/logwatch.conf
# cp /usr/share/logwatch/default.conf/logwatch.conf /usr/share/logwatch/default.conf/logwatch.conf.$(date +%F)
2. 進行修改
# sed -i ‘s/MailTo = root/MailTo = xxxx@gmail.com/’ /usr/share/logwatch/default.conf/logwatch.conf
# sed -i ‘s/MailFrom = Logwatch/MailFrom = Logwatch@nxi.test.ilc.edu.tw/’ /usr/share/logwatch/default.conf/logwatch.conf
# sed -i ‘s/Output = stdout/Output = mail/’ /usr/share/logwatch/default.conf/logwatch.conf
# sed -i ‘s/Detail = Low/Detail = Med/’ /usr/share/logwatch/default.conf/logwatch.conf
3. 執行 logwatch 測試是否能收到信件
# /usr/sbin/logwatch.pl