CentOS 6.5 64-bit system uses Baidu cloud free backup file

Source: Internet
Author: User
Tags line web mkdir php download centos


Environment:
System version: CentOS 6.5 x86_64
PHP version: php 5.3.3

I. INTRODUCTION

Because my vps space is very small, it is a pity that my Baidu cloud disk has dozens of TB disks, but Baidu cloud disk does not have a Linux version, therefore, a great God wrote a Baidu pcs Upload script. Now we need to use this script to connect Baidu Cloud and upload the file to Baidu Cloud. Baidu pcs Upload script official website: http://oott123.github.io/bpcs_uploader/

II. Installation and configuration

1. System requirements

Php and curl must be installed in Linux.

2. Install and configure

[Root @ web_us ~] # Wget https://github.com/oott123/bpcs_uploader/tarball/master # download files
[Root @ web_us ~] # Tar-zxvf master # decompress
[Root @ web_us ~] # Mv oott123-bpcs_uploader-3a75324/bdy # Change the name to bdy
[Root @ web_us ~] # Cd bdy/
[Root @ web_us bdy] # chmod a + x bpcs_uploader.php
[Root @ web_us bdy] # which php
Edit the bpcs_uploader.php file and change/usr/bin/php in the first line to the queried php path.
[Root @ web_us bdy] #./bpcs_uploader.php quickinit
Enter y when the prompt is displayed.
The prompt "Input g73gjbbp as the user code if asked." appears.
Then open http://openapi.baidu.com/device, and then g73jbbp. each individual's authorization code is different.
After the input is complete, "you have successfully authorized bpcs_uploader" appears !" Return to the configuration page and press enter to continue
"Access Granted. Your Storage Status: 0.00G/5.00G (0.00%)" is displayed, and the cloud disk is successfully connected. This indicates that the disk space is displayed,

Bpcs Upload script is installed

[Root @ web_us ~] # Mv bdy/usr/local/

3. Operation usage

# Uploading files
[Root @ web_us ~] #/Usr/local/bdy // bpcs_uploader.php upload [path_local] [path_remote]
E.g./usr/local/bdy/bpcs_uploader.php upload/Web/BAK/looking_s_20140914.tar.gz/web/looking_s_20140914.tar.gz
# Download an object
/Usr/local/bdy/bpcs_uploader.php download [path_local] [path_remote]
# Deleting an object
./Bpcs_uploader.php delete [path_remote]
E.g./usr/local/bdy/bpcs_uploader.php delete/web/looking_s_20140914.tar.gz
# Offline download
./Bpcs_uploader.php fetch [path_remote] [path_to_fetch]
E.g./usr/local/bdy/bpcs_uploader.php fetch/web/forai_20140914.tar.gz/tmp/forai_20140914.tar.gz
# Query capacity
./Bpcs_uploader.php quota
E.g./usr/local/bdy/bpcs_uploader.php quota

III. Use Baidu Cloud's automatic backup script for sharing

#! /Bin/bash
Webpath =/Web/
Mysql_u = root
Mysql_p = 123456
Bakcup_dir =/Web/BAK
Log_date = 'date + % F'
Date_1 = 'date + % Y % m % d'
File_conf =/tmp/conf _ $ {date_1}
Date_2 = 1
Bdy_dir =/usr/local/bdy
Logs_dir =/logs
 
If [! -D $ logs_dir]
Then
Mkdir-p $ logs_dir
Fi
Cd $ webpath
Echo "Log date: $ log_date" >>$ logs_dir/backup. log
Ls-l | grep "^ d" | grep-v "default \ | dl \ | Bakcup \ | BAK" | awk '{print $9}'> site. list
For line in $ (cat site. list );
Do
Tar-czvf $ bakcup_dir/${line1__${date_1).tar.gz $ webpath/$ line/public_html/
$ Bdy_dir/bpcs_uploader.php upload $ {bakcup_dir}/${line1__1_date_11_.tar.gz/web/${line1__1_1_date_11_.tar.gz
If ['echo $? '-Eq "0"]; then
Echo "$ line Web file backup succesed! ">>$ Logs_dir/backup. log
Else
Echo "$ line Web file backup failed! ">>$ Logs_dir/backup. log
Fi
/Usr/local/mysql/bin/mysqldump-u $ mysql_u-p $ mysql_p $ line> $ bakcup_dir/$ {line }_$ {date_1}. SQL
$ Bdy_dir/bpcs_uploader.php upload $ {bakcup_dir}/$ {line }_$ {date_1}. SQL/$ {line }_$ {date_1}. SQL
If ['echo $? '-Eq "0"]; then
Echo "$ line Web file backup succesed! ">>$ Logs_dir/backup. log
Else
Echo "$ line Web file backup failed! ">>$ Logs_dir/backup. log
Fi
Done
Rm-rf site. list
Find $ bakcup_dir-name "*. *"-type f-mtime + $ {date_2}-exec rm {}\;
Mkdir-p $ file_conf
Cp/etc/my. cnf $ file_conf/
Cp/usr/local/php/etc/php. ini $ file_conf/
Php-fpm.conf $ file_conf/cp/usr/local/php/etc/
Cp-R/usr/local/seng.pdf/conf $ file_conf/nginx_conf
Cp-R/usr/local/pureftpd/etc $ file_conf/ftp_conf
Tar-czvf $ bakcup_dir/conf_1_1_date_1).tar.gz $ file_conf/
$ Bdy_dir/bpcs_uploader.php upload $ {bakcup_dir}/conf_00000000date_10000.tar.gz/conf/conf_00000000date_10000.tar.gz
If ['echo $? '-Eq "0"]; then
Echo "$ line Web file backup succesed! ">>$ Logs_dir/backup. log
Else
Echo "$ line Web file backup failed! ">>$ Logs_dir/backup. log
Fi
Rm-rf $ file_conf
# Upload web_file

IV. FAQs

Question 1:

Xxx () has been disabled for security reasons
Solution:
Modify php. ini to cancel disabled functions

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.