#!/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) |