I have been in contact with CentOS for a few months. Windows that has been used for a long time is really a little uncomfortable when I first came into contact with the Linux command line interface. But in the end, I should have everyone’s words. The longer the linux contact, the more conducive to her simplicity and efficiency, I have a server installed operating system is CentOS5.4, deployed on the site and database applications, the basic framework: centos+nginx+mysql+ Php, but because the website data is more, it is too time-consuming to manually back up, so I plan to do an automatic running script to help me back up the website content and database content at the specified time of the week, package it with tar, and then pass it to On my other ftp server, the entire backup process is complete.
Assume that the website directory of this server is: /home/www, the database program path is: /usr/local/mysql/bin, the database name is: levil, and the ftp server is: ftphost. Complete automatic backup script (automatic backup script save location: /home/backup.sh):
#!/bin/bash cd /home WebBakName=web_$(date +%y%m%d) .tar.gz tar zcvf $WebBakName www SqlBakName=sql_$(date +%y%m%d).tar.gz /usr/local/mysql/bin/mysqldump -uusername -ppassword levil>backup.sql tar zcvf $SqlBakName Backup.sql ftp -nv ftphost << EOF user ftpname ftppass put $WebBakName put $SqlBakName quit EOF rm -f backup.sql $WebBakName $SqlBakName
Let's explain it to everyone: First enter /Home directory, define the WebBakName variable for the file name of the website backup, the file name format is web_date.tar.gz, define the SqlBakName variable as the file name of the database backup, the file name format is sql_date.tar.gz, put the entire website The directory www is packaged into the WebBakName file name, use mysqldump to export the specified database contents to backup.sql Then the database backup is packaged into the SqlBakName file, the local backup work ends here. If you do not have enough remote ftp space, you can directly download the backup file to the machine, but I still recommend directly backing up to another server. In the ftp space, to fully automate the backup, you need to replace the ftphost, ftpname and ftppass in the script with your ftp information, and the entire backup process is completed.
Then enter chmod +x backup.sh to add execute permission to the script, then enter: crontab -e to edit the task automatic start time, for example, I type: 00 05 * * 1 /home/backup.sh means each The automatic backup operation is performed at 5 am on week 1.
After all this is done, you can change the automatic task time to the current proximity time to see if the automatic backup script works normally. If you test OK, you don't have to worry about any problems with this server. Of course, if your data is updated frequently, it is recommended to adjust the automatic backup time to daily.
Let your website open second, enable for IIS "content expiration&&&;quo; Wha
The subject of this article is the SELinux configuration on RHEL 5. RHEL also provides a graphical u
On April 14, 2010 Intel Information Technology Summit (IDF) entered the second da
After a long-running website program of the company, the speed is slower. Aft
Talking about SQL Server System Troubleshooting Top Skills
Apache opens Gzip and Expires to improve page load speed
Teach you three tricks, and the electrical fire in the computer room said no!
It is no longer difficult to troubleshoot web server failures!
Analysis of the main difference between UPS and EPS power supply
Teach you how to install and configure a server cluster system
Detailed explanation: Ten processor parameters of server processor products
Windows2003 Domain Rename Tool (2)
How to configure NFS server under Linux?
Win10mobile 10536 installation error how to do
Making Vista and Windows 7 systems more secure There are five things you should know about (1)
Windows 7 Safe Mode Repair System Failure
Win10 TH2 official version update detailed: no SP nor Win10.1 and other distinctions
How to fix the problem of inserting a disc when burning Windows 7 please insert the disc problem
Windows vista experience after a few months of use
Computer xp system installation tutorial - Step 10: Set up the system (1) (a)
Windows 7 practical skills classification warehouse "library"