linux下設定郵件自動傳送
--設定自動任務
[oracle@db ~]$ crontab -l
1 1 * * * /var/monitor/db/backup_mail.sh
---設定傳送郵件的主題hostname+rman_backup+日期
--呼叫
[oracle@db ~]$ more /var/monitor/db/backup_mail.sh
export LANG=en
/var/monitor/db/db.sh /var/monitor/db/1440
cat /var/monitor/db/log/rman.log |mail -s `hostname`"_rman_backup_"`date +%F_%H:%m` 1@163.com,2@163.com
--DB.SH
[oracle@db ~]$ more /var/monitor/db/db.sh
if [ $# -ne 1 -o -z "${1}" ]; then
echo "Usage : $0 TAGNAME"
exit 1
fi
echo "Start Time: "`date +%Y-%m-%d_%H:%M:%S`
source /home/oracle/.bash_profile
PWD=$1
SQL="sqlplus / "\"as\ sysdba\"""
export PWD
export SQL
echo "Run SQL Scripts"
for line in `ls $PWD/*.sql`; do echo $SQL" @"$line; done|sh
echo "Run Shell Scripts"
for line in `ls $PWD/ora*.sh`;do echo "sh "$line">> /var/monitor/db/log/db.log";done|sh
echo "End Time: "`date +%Y-%m-%d_%H:%M:%S`
--STATUS
[oracle@VM_76_4_centos 1440]$ ls
rman_backup_status.sql
[oracle@VM_76_4_centos 1440]$ more rman_backup_status.sql
set linesize 200
alter session set nls_date_format='yyyy-mm-dd hh24:mi:ss';
col message for a50
set pagesize 999
spool '/var/monitor/log/rman.log'
select rs.OBJECT_TYPE||' '||rs.OPERATION||' '||rs.STATUS||'.'as message,rs.START_TIME||'~'||rs.END_TIME time
from v$rman_status rs
where rs.START_TIME>sysdate - 1
and rs.OPERATION like '%BACKUP%'
order by rs.START_TIME;
spool off;
exit
[oracle@VM_76_4_centos 1440]$
/etc/mail.rc
[oracle@db ~]$ crontab -l
1 1 * * * /var/monitor/db/backup_mail.sh
---設定傳送郵件的主題hostname+rman_backup+日期
--呼叫
[oracle@db ~]$ more /var/monitor/db/backup_mail.sh
export LANG=en
/var/monitor/db/db.sh /var/monitor/db/1440
cat /var/monitor/db/log/rman.log |mail -s `hostname`"_rman_backup_"`date +%F_%H:%m` 1@163.com,2@163.com
--DB.SH
[oracle@db ~]$ more /var/monitor/db/db.sh
if [ $# -ne 1 -o -z "${1}" ]; then
echo "Usage : $0 TAGNAME"
exit 1
fi
echo "Start Time: "`date +%Y-%m-%d_%H:%M:%S`
source /home/oracle/.bash_profile
PWD=$1
SQL="sqlplus / "\"as\ sysdba\"""
export PWD
export SQL
echo "Run SQL Scripts"
for line in `ls $PWD/*.sql`; do echo $SQL" @"$line; done|sh
echo "Run Shell Scripts"
for line in `ls $PWD/ora*.sh`;do echo "sh "$line">> /var/monitor/db/log/db.log";done|sh
echo "End Time: "`date +%Y-%m-%d_%H:%M:%S`
--STATUS
[oracle@VM_76_4_centos 1440]$ ls
rman_backup_status.sql
[oracle@VM_76_4_centos 1440]$ more rman_backup_status.sql
set linesize 200
alter session set nls_date_format='yyyy-mm-dd hh24:mi:ss';
col message for a50
set pagesize 999
spool '/var/monitor/log/rman.log'
select rs.OBJECT_TYPE||' '||rs.OPERATION||' '||rs.STATUS||'.'as message,rs.START_TIME||'~'||rs.END_TIME time
from v$rman_status rs
where rs.START_TIME>sysdate - 1
and rs.OPERATION like '%BACKUP%'
order by rs.START_TIME;
spool off;
exit
[oracle@VM_76_4_centos 1440]$
/etc/mail.rc
set from=發件人
set smtp=smtp.163.com
set smtp-auth-user=使用者名稱
set smtp-auth-password=密碼
set smtp-auth=login
set smtp=smtp.163.com
set smtp-auth-user=使用者名稱
set smtp-auth-password=密碼
set smtp-auth=login
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/21302630/viewspace-1731566/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- kettle 郵件傳送設定
- Linux自動下傳送HTML格式並帶附件的郵件LinuxHTML
- Springboot 自動傳送郵件Spring Boot
- 定時傳送郵件
- linux下設定傳送含中文字元郵件的crontabLinux字元
- node 定時傳送郵件
- Linux配置msmtp+mutt傳送郵件(可放在指令碼中定時傳送郵件)Linux指令碼
- [linux]linux傳送郵件Linux
- 郵件傳送
- 傳送郵件
- 使用Linux命令傳送郵件Linux
- linux formail 傳送html郵件LinuxORMAIHTML
- linux自動重起服務,併傳送郵件通知結果Linux
- 收到263定時傳送郵件的傳送提醒
- 【實用主義】如何用nodejs自動定時傳送郵件提醒?NodeJS
- Bugfree郵件傳送設定(以QQ郵箱為例)
- SpringBoot整合Mail傳送郵件&傳送模板郵件Spring BootAI
- Python3實現自動傳送MySql查詢併傳送郵件PythonMySql
- ASP.NET自動傳送郵件功能的實現ASP.NET
- 自動生成addm報告並以郵件傳送
- 自動生成AWR報告並以郵件附件傳送
- Laravel 傳送郵件Laravel
- PHP傳送郵件PHP
- Django——郵件傳送Django
- java郵件傳送Java
- Laravel傳送郵件Laravel
- gmail傳送郵件AI
- Oracle郵件傳送Oracle
- java傳送郵件Java
- Powershell郵件傳送
- thinkphp 郵件傳送PHP
- centos 傳送郵件CentOS
- phpcms傳送郵件PHP
- 郵件的傳送
- 郵件營銷自動化:批次郵箱API傳送技巧與策略API
- gitlab自動定時備份檔案,備份失敗傳送郵件Gitlab
- 使用oracle job定時傳送email郵件OracleAI
- Redmine釋出新聞,自動傳送郵件功能失效恢復