Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

WordpressQQ email alarm notification + number of automatic backups of Baidu network disk

2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

1. Mailbox settings 2. Network disk settings 3. Synchronization policy

At present, the demand for self-built websites is increasing, but the maintenance and message notification mechanism of some websites has not been suitable; therefore, this chapter realizes simple mailbox alarm and network disk synchronization based on QQ mailbox and Baidu network disk, so that we can better manage our personal websites.

First, the configuration is automatically sent to QQ mailbox:

Set and obtain authorization password for smtp.qq.com

QQ home page or web page login to QQ mailbox

click Settings

Select Account Settings

A value descends to find a POP3-style service, and then opens the service

SMS authentication

Return to POP3 default key

Detailed server configuration

[root@localhost ~]#

[root@localhost ~]# yum install mailx sendmail -y #install corresponding mail service Loaded plugins: fastestmirrorLoading mirror speeds from cached hostfile * base: mirrors.huaweicloud.com * extras: mirrors.huaweicloud.com * updates: mirrors.tuna.tsinghua.edu.cnPackage mailx-12.5-19.el7.x86_64 already installed and latest versionPackage sendmail-8.14.7-5.el7.x86_64 already installed and latest versionNothing to do

[root@localhost ~]#

[root@localhost ~]#

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

[root@localhost ~]#

[root@localhost ~]# tail -n 4 /etc/mail.rc Modify the configuration file to put QQ mailbox information and release the POP3 password obtained by typing here set from=11111111@qq.com smtp="smtp.qq.com" set smtp-auth-user="111111@qq.com" smtp-auth-password="whttbh 77 sdfsgrobf" #No spaces required between keys set smtp-auth=login

[root@localhost ~]#

[root@localhost ~]#

[root@localhost ~]# echo 'test'| mail-s 'warning' 1111111@qq.com Test whether the email can be received normally

Second, install the connection Baidu network disk plug-in bypass

Python is a python-based program. All installation requires python environment. Fortunately, centos and Ubuntu have it. You need to pay attention to the python version of the current system. Then download python, which is equivalent to yum or apt manager of python program, and install python through ip.

yum install python2-pip -y

Install pip package manager

yum install python3-pip -y

Install the bypass program

pip install bypy

After installation, use bypass info to generate link code to authorize bypass program

Authorization code rendering

At this point, Baidu network disk synchronization has been initially completed

Bypy common command

1. Upload this directory to cloud disk (synchronization does not affect local data, just a simple copy)

bypy upload [localpath] [remotepath] [ondup]

2. Download cloud disk directory to local

bypy downdir [remotedir] [localdir]

3. Download cloud disk files to local

bypy downfile [localpath]

4. View the directory files in the network disk

bypy list [remotepath] [format] [sort] [order]

D for directory F for file

5. Compare local and cloud disks

bypy compare [remotedir] [localdir]

6. Other commands can be viewed for help

bypy --help

3. Automatic alarm and synchronization configuration based on base script

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

#!/ bin/bash#DiskPcent=`df /dev/sda1 --output=source,pcent |awk -F'[ ]*|%''/^\/dev\/sd/ {print $2}'`#Check if local disk occupancy is greater than 60if [ $DiskPcent -gt 60 ];then echo "waring copy file!! " find /tmp/log >./ filelist TIME=`date +%F_$RANDOM` tar czPf ${TIME}.tar.gz `cat filelist` bypass upload backup to Baidu net disk if [ $DiskPcent -gt 70 ];then echo "warning devsdb is full" QQ mailbox alarm notification administrator if disk is larger than 70 echo "plase check the data disk"|mail -s 'error' 11111111@qq.comfifi

Set up timed tasks

crontab -e

0 1 * * 1 /usr/bin/bash /baidu/backup.sh

One backup a week at 1:00 a.m.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 229

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report