溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

wordpressQQ郵件告警通知+Baidu網(wǎng)盤(pán)自動(dòng)備份數(shù)

發(fā)布時(shí)間:2020-06-02 18:44:55 來(lái)源:網(wǎng)絡(luò) 閱讀:238 作者:wx5baa4aff60c00 欄目:系統(tǒng)運(yùn)維

wordpressQQ郵件告警通知+Baidu網(wǎng)盤(pán)自動(dòng)備份數(shù)

1、郵箱設(shè)置

2、網(wǎng)盤(pán)設(shè)置

3、同步策略

 
 
 
前言:目前自建網(wǎng)址的需求越來(lái)越多,但是一些網(wǎng)站的維護(hù)和消息通知機(jī)制,一直不太適宜;所以本章基于QQ郵箱和百度網(wǎng)盤(pán)實(shí)現(xiàn)簡(jiǎn)單的郵箱告警和網(wǎng)盤(pán)同步,讓我們更好的管理我們的個(gè)人網(wǎng)址

<h6 id=1>一、配置自動(dòng)發(fā)送到QQ郵箱:</h6>

設(shè)置并取得 smtp.qq.com 的 使用 授權(quán)密碼
QQ首頁(yè)或者網(wǎng)頁(yè)登錄到QQ郵箱
wordpressQQ郵件告警通知+Baidu網(wǎng)盤(pán)自動(dòng)備份數(shù)
點(diǎn)擊設(shè)置
wordpressQQ郵件告警通知+Baidu網(wǎng)盤(pán)自動(dòng)備份數(shù)
選擇賬戶設(shè)置
wordpressQQ郵件告警通知+Baidu網(wǎng)盤(pán)自動(dòng)備份數(shù)
一值下滑找到POP3樣式的服務(wù),然后開(kāi)啟服務(wù)
wordpressQQ郵件告警通知+Baidu網(wǎng)盤(pán)自動(dòng)備份數(shù)
短信驗(yàn)證身份

wordpressQQ郵件告警通知+Baidu網(wǎng)盤(pán)自動(dòng)備份數(shù)
返回POP3默認(rèn)密鑰
wordpressQQ郵件告警通知+Baidu網(wǎng)盤(pán)自動(dòng)備份數(shù)
服務(wù)端詳細(xì)配置

[root@localhost ~]#

[root@localhost ~]# yum install mailx sendmail -y  #安裝對(duì)應(yīng)mail郵件服務(wù)
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.huaweicloud.com
 * extras: mirrors.huaweicloud.com
 * updates: mirrors.tuna.tsinghua.edu.cn
Package mailx-12.5-19.el7.x86_64 already installed and latest version
Package sendmail-8.14.7-5.el7.x86_64 already installed and latest version
Nothing to do

[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# vi /etc/mail.rc
[root@localhost ~]#

[root@localhost ~]# tail -n 4 /etc/mail.rc  修改配置文件把QQ郵箱信息和放出獲取的POP3密碼鍵入此處

set from=11111111@qq.com smtp="smtp.qq.com"   
set smtp-auth-user="11111111@qq.com" smtp-auth-password="whtobh77sdfsgroobf" #密鑰之間不需要輸入空格
set smtp-auth=login

[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# echo 'test'|mail -s 'warning' 111111111@qq.com 測(cè)試郵件是否正常能收到

<h6 id=2> 二、安裝連接百度網(wǎng)盤(pán)插件bypy</h6>

bypy是基于python的程序所有安裝時(shí)需要python環(huán)境,好在一般centos和Ubuntu都有,需要注意當(dāng)前系統(tǒng)的python版本,然后下載pip,相當(dāng)于python程序的yum或apt管理器,然后通過(guò)pip安裝bypy
yum install python2-pip -y
安裝pip包管理器
yum install python3-pip -y
安裝bypy程序
pip install bypy
wordpressQQ郵件告警通知+Baidu網(wǎng)盤(pán)自動(dòng)備份數(shù)
安裝后使用bypy info生成鏈接碼給bypy程序授權(quán)
wordpressQQ郵件告警通知+Baidu網(wǎng)盤(pán)自動(dòng)備份數(shù)
授權(quán)碼效果圖
wordpressQQ郵件告警通知+Baidu網(wǎng)盤(pán)自動(dòng)備份數(shù)
至此百度網(wǎng)盤(pán)同步已初步完成

bypy常用命令
1、上傳本目錄到云盤(pán)(同步并不影響本地?cái)?shù)據(jù),只是一次簡(jiǎn)單的copy)
bypy upload [localpath] [remotepath] [ondup]

2、下載云盤(pán)目錄到本地
bypy downdir [remotedir] [localdir]

3、下載云盤(pán)文件到本地
bypy downfile &lt;remotefile&gt; [localpath]

4、查看網(wǎng)盤(pán)中的目錄文件
bypy list [remotepath] [format] [sort] [order]
wordpressQQ郵件告警通知+Baidu網(wǎng)盤(pán)自動(dòng)備份數(shù)
D表示目錄 <br/>F表示文件

5、比較本地和云盤(pán)
bypy compare [remotedir] [localdir]
wordpressQQ郵件告警通知+Baidu網(wǎng)盤(pán)自動(dòng)備份數(shù)
6、其它命令可以看幫助
bypy --help

 
 

<h6 id=3>三、自動(dòng)化告警和同步配置基于base腳本實(shí)現(xiàn)</h6>

[root@97 ~]#cat scripts/checkdisk.sh

#!/bin/bash
#
DiskPcent=`df /dev/sda1 --output=source,pcent |awk -F'[ ]*|%' '/^\/dev\/sd/ {print $2}'`
#檢查本地磁盤(pán)占用值是否大于60
if [ $DiskPcent -gt 60 ];then
   echo "waring copy file!!"
   find /tmp/log   >./filelist  
   TIME=`date +%F_$RANDOM`
   tar czPf ${TIME}.tar.gz `cat filelist` 
   bypy upload  備份到百度網(wǎng)盤(pán)
if [ $DiskPcent -gt 70 ];then
   echo "waring devsdb is full"  如果磁盤(pán)大于70則QQ郵箱告警通知管理員
   echo "plase check the data disk"|mail -s 'error' 11111111@qq.com
fi
fi

設(shè)置定時(shí)任務(wù)
crontab -e
0 1 * * 1 /usr/bin/bash /baidu/backup.sh
每周凌晨一點(diǎn)備份一次

向AI問(wèn)一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI