The statistical results are automatically sent by mail, and mutt is used. the installation of mutt is simple: yuminstallmutt, which can be used after installation. Mutt is really a good thing. it can send emails without starting sendmail or postfix, and it is much better than the built-in mail. The mutt syntax in linux5 is echo & quot; hell
The statistical results are automatically sent by mail, and mutt is used. The mutt installation is simple: yum install mutt, which can be used after installation.
Mutt is really a good thing. it can send emails without starting sendmail or postfix, and it is much better than the built-in mail.
In linux5, the mutt syntax is:
Echo "hello" | mutt-a test.txt-s "date" admin@test.com
Subject recipient of the body attachment
The mutt syntax in linux6 is
Echo "hello" | mutt-a test.txt-s "date" -- admin@test.com
Subject recipient of the body attachment
View mutt help: mutt-h
Modify the sender information (to avoid using the root @ host name. host domain name as a spam email)
Under the user who needs to send an email
Create the following files
Vi ~ /. Muttrc
Set envelope_from = yes
Set
Set realname = "yourname"
Set use_from = yes
# If the received email is garbled, set the following information:
Set charset = "UTF-8"
Set rfc2047_parameters = yes
The stored procedure of regular statistics is omitted.
The following is a script to automatically generate statistical results using shell:
#! /Bin/bash
Source/home/oracle/. bash_profile
Cd/home/oracle/zhangwz/
Rm-rf log
Sqlplus-s zhangwz/****** <EOF> log
Set feed off
-- Execute the process and put the result in the table losscall.
Exec p_losscall;
--Put the losscallresult in 1.txt
Set lines 400;
Set pages 9000;
Spool 1.txt
Select rownum sn, losscall. * from losscall;
Spool off;
Exit
EOF
Filename = 'date + % Y % m % d-% H % M'
Sed '1D '1.txt> export filename.csv
Rm-rf 1.txt
Hour = 'date | cut-c 18-20'
If [$ hour-eq 9]
Then
Echo "XX, hello:
The appendix is the call loss phone number from yesterday to today. "| Mutt-a fill filename.csv-s" call loss phone "zhangwz@xx.net
Elif [$ hour-eq 13]
Then
Echo "XX, hello:
The appendix is the call loss number from. "| Mutt-a fill filename.csv-s" call loss phone "zhangwz@xx.net
Else
Echo "XX, hello:
The appendix is the call loss number from. "| Mutt-a fill filename.csv-s" call loss phone "zhangwz@xx.net
Fi
Rm-rf *. csv