美好的生活需要用心记录
我的笔记本安装了三块硬盘,其中两块机械硬盘,一块SSD硬盘,其中存放了很多数据,为了数据安全准备弄一个硬盘SMART监控软件,Linux下面用smartmontools进行监控.
安装smartmontools:
sudo apt install smartmontools
接着让他开机自动启动监控,编辑/etc/default/smartmontools文件:
start_smartd=yes
然后编辑配置文件/etc/smartd.conf把默认的监控提示改成这样:
EVICESCAN -d removable -n standby -m xuanzc880@outlook.com -M exec /usr/local/bin/smartdnotify -M test
#!/bin/sh # Send mail echo "$SMARTD_MESSAGE" | mail -s "$SMARTD_FAILTYPE" "$SMARTD_ADDRESS" # Notify user sudo -u user DISPLAY=:0 notify-send "S.M.A.R.T Error ($SMARTD_FAILTYPE)" "$SMARTD_MESSAGE" --icon=dialog-warning
安装E-mail服务:
sudo apt install s-nail ssmtp
修改/etc/ssmtp/revaliases文件:
user:12345678900@139.com:smtp.139.com:465 root:12345678900@139.com:smtp.139.com:465
然后修改/etc/ssmtp/ssmtp.conf:
root=12345678900@139.com mailhub=smtp.139.com:465 rewriteDomain=139.com hostname=smtp.139.com AuthUser=12345678900 AuthPass=11223344 FromLineOverride=YES UseTLS=YES
现在你可以用此命令发送邮件进行测试:
echo "测试smtp服务器能不能用" | mail -v -s "" 00123456@xxx.com
然后启动(或者重启)smartd服务,如果正常出现桌面警告提示和E-mail测试邮件说明整个监控系统配置正常,这样就可以删除/etc/smartd.conf文件后面的-M test参数了.
评论:
2017-06-14 06:24