Chinaunix首页 | 论坛 | 博客
  • 博客访问: 412163
  • 博文数量: 77
  • 博客积分: 2303
  • 博客等级: 大尉
  • 技术积分: 808
  • 用 户 组: 普通用户
  • 注册时间: 2004-11-30 09:15
文章存档

2015年(1)

2013年(3)

2012年(2)

2011年(46)

2009年(4)

2008年(2)

2005年(12)

2004年(7)

我的朋友

分类: 系统运维

2011-06-24 10:11:00

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
阅读(1661) | 评论(0) | 转发(1) |
0

上一篇:jxl颜色表

下一篇:开通blog:)

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