Chinaunix首页 | 论坛 | 博客
  • 博客访问: 300470
  • 博文数量: 47
  • 博客积分: 1667
  • 博客等级: 上尉
  • 技术积分: 686
  • 用 户 组: 普通用户
  • 注册时间: 2010-05-06 16:20
文章分类

全部博文(47)

文章存档

2013年(20)

2012年(20)

2011年(7)

分类: Python/Ruby

2012-07-20 16:20:07

#!/usr/bin/perl
###发送parse日志的最后50行###

use warnings;
use strict;
use MIME::Lite;

my $file1='/tmp/parse_fund_rel_log.log';
my $file2='/tmp/parse_news_log.log';


my $f1=`tail  -50 /tmp/parse_fund_rel_log.log`;
my $f2=`tail  -50 /tmp/parse_news_log.log`;
my $code = system(" tar cvzf  /tmp/parse_log.tar.gz  /tmp/parse_news_log.log  /tmp/parse_fund_rel_log.log ") ;
#print $code;

my $msg = MIME::Lite->new (
           From => 'aa@163.com',
               To => 'bb@163.com',
               Cc => 'cc@163.com',
                   Subject => 'parse_log ',
                       Type => 'multipart/mixed'
                   );
                  $msg->attach(
                      Type => 'TEXT',
                      Data => "$file1 \n $f1 \n\n $file2\n $f2"
                  );
                   $msg->attach(
                          Type => 'auto',
                             Path => '/tmp/parse_log.tar.gz',
                                );

                                $msg->send('smtp',
                                'smtp.exmail.qq.com',
                                AuthUser =>'aa@cctvcjw.com',
                                AuthPass =>'11'
                              );
my $code2 = unlink "/tmp/parse_log.tar.gz";
阅读(1831) | 评论(0) | 转发(0) |
0

上一篇:监控D盘容量删除

下一篇:puppet 发布apache

给主人留下些什么吧!~~