Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1013015
  • 博文数量: 584
  • 博客积分: 2293
  • 博客等级: 大尉
  • 技术积分: 3045
  • 用 户 组: 普通用户
  • 注册时间: 2006-03-28 11:15
文章分类

全部博文(584)

文章存档

2012年(532)

2011年(47)

2009年(5)

我的朋友

分类:

2012-08-04 23:02:45

1.配制mail
hosts第二列要为全域名.
bash-3.00# less /etc/hosts
#
# Internet host table
#
::1     localhost       
127.0.0.1       localhost       
192.168.195.61  mdc-solsvr.org  mdc-solsvr      loghost
192.168.203.61  mdc-yz.org  mdc-yz

确认sendmail服务在enable状态,如是disable请开启服务(mailx需调用sendmail来发信)
svcadm enable sendmail

-bash-3.00$ svcs -a|grep mail
online          9月_21  svc:/network/smtp:sendmail

2.脚本
-bash-3.00$ cat SendOperAccMonth.sh
#!/bin/bash

source /export/home/oracle/.profile
#date=`date '+%Y-%m-%d'`
fromaddr='qhchen_auto_acc@mdc.cn'
toaddr='qhchen@mdc.cn,yfxu@mdc.cn'
sdate=`sqlplus -s mdc/mdc@wxdb <       alter session set nls_date_format='yyyymmdd hh24:mi:ss';
       select trunc(last_day(add_months(sysdate,-2))+1) " " from dual;
       exit
       EOF
      `
sdate=`echo $sdate | nawk '{print $4}'`

odate=`sqlplus -s mdc/mdc@wxdb <       alter session set nls_date_format='yyyymmdd hh24:mi:ss';
       select trunc(sysdate-1) " " from dual;
       exit
       EOF
      `
odate=`echo $odate | nawk '{print $4}'`

wx=`sqlplus -s mdc/mdc@wxdb <    select count(*) " " from operatorcalldata
      where begintime between trunc(last_day(add_months(sysdate,-2))+1) and trunc(sysdate) and operatorno like '0%';
    exit
    EOF
    `
yz=`sqlplus -s mdc/mdc@yzdb <    select count(*) " " from operatorcalldata
      where begintime between trunc(last_day(add_months(sysdate,-2))+1) and trunc(sysdate) and operatorno like '0%';
    exit
    EOF
    `
sz=`sqlplus -s mdc/mdc@szdb <    select count(*) " " from operatorcalldata
      where begintime between trunc(last_day(add_months(sysdate,-2))+1) and trunc(sysdate) and length(caller)>10;
    exit
    EOF
    `
echo -e $sdate--$odate"\n"无锡:$wx"\n"扬州:$yz"\n"苏州:$sz | mailx -r $fromaddr -s "月话务量统计$sdate-$odate" $toaddr
阅读(979) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~