Junge's LNMP one-click WEB environment comes with a backup script to set up scheduled local and FTP remote backups.

888u

Last update at :2024-06-19,Edit by888u

Currently, we mostly use Junge’s Lnmp or yeho’s Oneinstack script to configure the WEB panelless environment in Linux systems. The former has been used for many years and has larger version updates every year. A few days ago, Snail also shared the V1.6 test version to be released this year, which is expected to be officially released on Children's Day every year. The current mature version is V1.5.

In terms of the configuration of the WEB environment, there is not much difference between the two panels. However, the lnmp tool is slightly weaker in some small tools. For example, it is not automated enough when backing up files and databases. If it is oneinstack, you can use scripts directly. Online configuration files and automatic backup (reference article: OneinStack comes with local/remote backup website files and database usage methods). However, functionally, the LNMP script is also provided, but we need to manually configure the file and then manually set the backup cycle.

First, configure the backup file

/root/lnmp1.5/tools

We can see the backup.sh script configuration file in the current lnmp script tools file

Second, modify the main parameters of the configuration file

######Set backup to directory######Backup_Home=\\”/home/backup/\\”MySQL_Dump=\\”/usr/local/mysql/bin/mysqldump\\” ######Set the file directory that needs to be backed up. ######Backup_Dir=(\\”/home/wwwroot/laozuo.org\\” \\”/home/wwwroot/laobuluo.com\\” )

######Set the database user that needs to be backed up######Backup_Database=(\\”laozuo\\” \\”laobuluo\\”)

######Set database total account information######MYSQL_UserName=\\’root\\’MYSQL_PassWord=\\’yourrootpassword\\’

######Set 0 to enable it######Enable_FTP=0# 0: enable; 1: disable######Configure remote FTP space account information######FTP_Host= \\'1.2.3.4\\'FTP_Username=\\'vpser.net\\'FTP_Password=\\'yourftppassword\\'FTP_Dir=\\”backup\\”

Here we can base on the server configuration information, as well as the website directory files and database configuration that need to be backed up. At present, lnmp is weak in that remote backup does not seem to have access to optional Alibaba Cloud OSS, Tencent Cloud COS, or third-party cloud storage such as Qiniu Cloud and Youpai Cloud. It only has FTP space accounts. If we need to use LNMP remote backup, the script comes with only remote access to the prepared FTP space.

Third, check whether the backup is valid

cd /root/lnmp1.5/tools./backup.sh

After setting the save file, we execute it once to see if the backup is successful. Only when the backup is successful and there are no problems, can we add an automatic scheduled backup task.

Fourth, add scheduled backup tasks

Scheduled backup tasks definitely require the use of crontab.

crontab -e

If we have not installed crontab, we need to install it first, and then execute the script to add the command.

00 01 * * * /bin/bash /root/lnmp1.5/tools/backup.sh

Set up backup at 1am every day. If our cycle does not require daily backup, we can also set a longer interval in crontab, such as once a month or once a week.

Recommended site searches: PHP space purchase, expired registered domain name, Korean server rental, web page registration, how much does server defense cost, domain name query network, Hong Kong server, dynamic dial-up vps host, mainland China registration-free space, overseas host rental ,

Junge's LNMP one-click WEB environment comes with a backup script to set up scheduled local and FTP remote backups.

All copyrights belong to 888u unless special state
取消
微信二维码
微信二维码
支付宝二维码