cengtos7.6 把系统运行状况通过邮件定时发送
[root@vmhzpcentostest home]# vim mail.sh
[root@vmhzpcentostest home]# cat mail.sh
#!/bin/sh
echo "Linux服务器状态巡检" |mail -s "Linux服务器状态巡检" ****@163.com << EOF
`echo "----------- cpu load -----------"
uptime
echo "----------- who is login -----------"
who
echo "---------- disk used ----------"
df -hl
echo "---------- mem swap -----------"
free -h`
EOF
[root@vmhzpcentostest home]# crontab -e
crontab: installing new crontab
[root@vmhzpcentostest home]# crontab -l
*/1 * * * * bash /home/mail.sh