In order to protect the security of computer data, you need to periodically back up and delete the data of the website to prevent data loss caused by hacking. The following small series will introduce you how to regularly back up and delete website data under Linux. Let's learn.
demand is that, first of all website files and database to be automatically backed up every day, over a certain time and then the backup directory deletion, such as heaven and earth to retain the last 14 backup
just vps is redhat, There is no crond service installed by default. Enter the following command to install
yum install cronie
Create backup script
vi /root/bakweb.sh
Edit and enter the following
#! /bin/bash
find /home/bak/-name ‘*’ -type f -mtime +14 -exec rm {} \\;
tar zcvf /home/bak/Www.penglei.name_$(date +%F).tar.gz /var/www/html
mysqldump -u root --password=PASSWORD DBNAME 》
/home/bak/Sql.penglei.name_$(date +%F).sql
exit 0 Enter: wq to save and exit. The meaning of this script is to first select /home/bak as the website backup directory.
The first step is to delete the files under /home/bak for more than 14 days.
The second step is to back up the website directory /var/by www.jb51.name_+ date. Www/html;
In the third step, export the database by sql.penglei.name_+date as the file name, and replace PASSWORD and DBNAME with your own root password and database name.
Finally create a crond script that automatically runs the script at 5 am every morning to create a crond file
vi /etc/cron.d/bakweb Edit and enter the following
0 5 * * * root /root/bakweb.sh
The above is an introduction to the automatic backup and deletion of website data on the Linux system. For your computer security, the website data cannot be retained for a long time. Of course, you You can also manually back up and delete website data.
The management of disks and files is an important part of the daily maintenance of
If you want to make RPM package under Linux system, you can use FPM tool to complete it. The FPM too
After installing MPlayer in CentOS, some people have images without sound, and most
After installing the Solaris system, many users cant log in to Xmanager, and they cant connect to So
How to create a video DVD in a Linux desktop environment
How to restart Tomcat regularly on Linux system
What should I do if ORA-12528 reports an error when building DataGuard in Linux?
How to bind CPU process in Ubuntu?
Red Flag Linux Desktop 5 How to Use SAPGUI Client
Linux how to use vim for advanced editing
How to turn off IP access for Linux Apache server
Linux installation steps using GitHub
How to display the number of Linux subfolders and files
Linux how to use the locate command to find data
Ubuntu 14.04 method for loading shutdown/restart options in Dash
What should I do if the Linux crontab has a BAD FILE MODE error?
Win7 system comes with system restore
NT6 HDD Installer Raiders: Hard Disk Installation Windows 7 Tutorial
Crysis 3 configuration requirements, playing the minimum configuration requirements for the Crysis
Cancel IE9 disable add-on tips
Win8.1 Professional Edition activation key What win8.1 Professional Edition activation key details
Win10/wp developers can apply for free subscription to Xamarin tools. End of August 31
Where is the mouse movement speed of win8 computer modified
If Windows 8 is free, will you upgrade the installation?