参考:https://help.ubuntu.com/community/Smartmontools
https://wiki.gentoo.org/wiki/Smartmontools
https://www.smartmontools.org/browser/trunk/smartmontools/smartd.conf.5.in
在此之前需要配置好mail(参考:Linux通过命令发送邮件 ),以便发送邮件。
修改/etc/smartmontools/smartd.conf,删除之前的规则,加入自定义的规则。
- DEVICESCAN -H -m root -M exec /usr/libexec/smartmontools/smartdnotify -n standby,10,q
+ # xjn add
+ # 每周六1点:Offline Immediate Test,5点:Long Self-Test,9点:Conveyance Self-Test
+ DEVICESCAN -H -l error -l selftest -f -s (O/../../6/1|L/../../6/5|C/../../6/9) -m [email protected] -M exec /usr/share/smartmontools/smartd-runner
+ # 这个是用于测试邮件发送功能的,执行"service smartd restart"就会发送邮件
+ # DEVICESCAN -H -m [email protected] -M test