VPS back up website files and shell script tools from databases to cloud storage

Source: Internet
Author: User
Tags vps

VPS back up website files and shell script tools from databases to cloud storage

The tool shared today is also related to backup and remote backup. This tool is boring, although WordPress already has a backup plug-in such as wp2pcs. I believe that the webmaster of VPS will like this tool because it will not occupy resources.

I. Tool Archives

Tool Name: Backup_to_qiniu_by_zhangge-Ver1.0.sh

Tool language: Shell, json

Working environment: Linux

Function Description: schedules tasks in Linux to back up website files and databases to qiniu free cloud storage space.

Additional instructions:

The ghost tool uses zipping. if the system does not have zipping installed, it uses the Tartar package into the tar.gz format;

② In order to avoid Chinese garbled characters, all tools use foreign languages. The level of Zhang Ge is limited, and there may be a Chinese comparison below in the lame syntax );

③ Use the native interaction style. If the interface menu is not optimized, it will be used once for initialization.

Ii. Instructions for use

① Download tool:

Go to the VPS system and run the following command to download the tool:

 
 
  1. cd && wget http://mymsdn.qiniudn.com/backup/Backup_to_qiniu_by_zhangge-Ver1.0.sh

② Run the tool and enter the information as prompted:

 
 
  1. cd && ./Backup_to_qiniu_by_zhangge-Ver1.0.sh

The process is as follows:

 
 
  1. [Root @ jiukeyi ~] #./Backup_to_qiniu_by_zhangge-Ver1.0.sh
  2. Please input the webroot like/domain/zhangge.net/public_html:enter the path of your website file
  3. Please input the access_key: Enter the access_key of qiniu.
  4. Please input the secret_key: Enter secret_key of qiniu
  5. Please input the bucket name: enter the name of the Seven cattle Space
  6. Please input the mysql username: Enter the database account
  7. Please input the mysql password: Enter the Database password
  8. Please input the database name: Enter the database name
  9. Please input the backup path: Enter the temporary storage path of the backup file. Press enter to store the file in/usr/local/qiniu/backup.
  10. Please input the backup rate time (like 1/2/3 .. 30): Enter the backup interval. For example, input 7 indicates that backup is performed every seven days.
  11. # When you press enter, the message is successful:
  12. ==================================== The crontab list ============== ==================================
  13. # Add by QN_Backup Scripts
  14. 0 0 */7 ** sh/usr/local/qiniu/QN_backup.sh/www/web/default test2 123456/www/backup_temp mytest
  15. ==================================== The crontab list ============== ==================================
  16. Compelet!

The following is a test:

After the command is executed, you can copy the command line of crontab and manually execute the following command:

 
 
  1. sh /usr/local/qiniu/QN_backup.sh /www/web/default test2 123456 /www/backup_temp mytest

After the backup is successful, the space corresponding to qiniu will be able to see the file you just backed up:

The above process is initialization and only needs to be executed once. Of course, repeated execution does not matter, but only overwrites the settings.

Iii. Post-Maintenance

After completing the initialization settings, if you want to change the backup interval or backup target, you can edit the system scheduled task to redefine it:

 
 
  1. # Run crontab-e to open the scheduler task editing page.
  2. [Root @ jiukeyi ~] # Crontab-e
  3. # Add by QN_Backup Scripts
  4. 0 0 */7 ** sh/usr/local/qiniu/QN_backup.sh/www/web/default test2 123456/www/backup_temp mytest

The above 4th lines are Backup command lines, and the following are post-modification instructions:

The first five columns indicate the execution frequency, specifically the hour, day, month, and week. The tool is defined by day by default. */7 in the Code indicates that the backup is performed every 7 days;

/Www/web/default: Path of the website file to be backed up

Test2, 123456: database user name and password

/Www/backup_temp: backup file storage address. Each backup file is retained until the next backup is deleted. This is almost a local backup.

Mytest: Database Name

Ps: Of course, you can also insert Multiple Task plans based on your actual needs.

Iv. Outlook on tools

This tool is just a boring work of Zhang GE. There are not many VPS users, and they all have their own backup systems. The purpose of this tool is only to provide a way out for the backup website.

Depending on the popularity, the next version of the tool will be added

① Custom mechanism for separate backup of website files/databases;

② Make menus and separate projects, including interactive menus maintained at a later stage to improve ease of use

Source: Zhang Ge blog Author: Zhang Ge original link: http://zhangge.net/4212.html

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.