Linux 监控日志文件

来源:互联网 发布:淘宝主播逢丁吉吉 编辑:程序博客网 时间:2024/05/06 13:22

场景:生产环境的日志文件中有错误信息时,想通过邮件将错误内容发送给管理者。

#!/bin/bashmonitor=/product/log/file/pathcontent=/this/program/log/filetail -5 $monfile|grep fail >$contentif [ -s $content ];then    mail -s "mail title" -c xxx@xxx.com <$contentfi
0 0