Timed Automatic VPS Backup script realizes LLSMP environment website and database mailbox/ftp synchronous Backup

Source: Internet
Author: User
Tags vps

Since the beginning of the use of VPS is particularly important to focus on data security, whether we use the Web panel, or the use of a key to install the package, or even directly compile the environment, we can choose to manually backup on a regular basis, you can also use the Web Panel with the Backup tool. Today, a user mentioned the backup of the LLSMP environment, so in this article, the old left to share the blog once had an automatic backup script, and then after the complete write a copy of the LLSMP a key package environment backup tutorial.
Of course, if the use of LLSMP environment, can also be manually backed up by the sh/root/llsmp/backup.sh instructions to the VPS space, and then ftp download backup, you can also upgrade this instruction to automatically execute and pass data.

In many tutorials, we simply choose a suitable for their own habits, and there is no need for each environment and site to use different methods. So start sharing this article today about automatic scheduled backups, committing to the backup process in the mailbox, FTP host.

First, install the SendMail components

Because in this script, I will use mail and FTP to send together to ensure the security of data, so the way to use multiple-channel backup. Send mail here I'm using sendmail, so I need to install the components.
Apt-get Install SendMail Mutt
Run the above script in Debian, if it is CentOS, apt-get replace it with Yum, and then enter Y-carriage in the prompt to install OK. It is best to restart the VPS to achieve effective results.

Second, upload script edit parameters

http://soft.laozuo.org/scripts/autobackuptoftp.sh
Download the script to the local, and then compile the corresponding information:
mysql_user= Database User
mysql_pass= Database Password
mail_to= send a mailbox
FTP_USER=FTP User Name
ftp_pass=ftp Password
Ftp_ip=ftp Account IP
ftp_backup= the path folder for backup FTP
Web_data=/home/wwwroot #本地备份路径
and upload it to the root directory.

Iii. perform a scheduled backup of the script

chmod +x/root/autobackuptoftp.sh #执行文件赋予权限
Crontab-e #准备添加定时设置
* * * * */root/autobackuptoftp.sh # I command to enter the previous script, meaning to back up the data at 12 o ' Hour every night
Note: We can also perform the next sh/root/autobackuptoftp.sh to see if it is possible to manually back up the sync successfully.


After executing, I can see a database in the FTP space of the backup, one is the website file.

This completes the method of automatically backing up the Web site and database in the LLSMP scripting environment. It is best to manually back up the first time, if the backup is not successful can see the reason, and then resolved to automatically back up, or not.

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.