1· Windows delete regularly @Echo OFF//set SrcDir=E:\mysqlup_bk\pa010_11 //specified path//set DaysAgo=5 //5 days ago forfiles /p "E:\mysqlup_bk\pa010_11" /s /m *.psc /d -5 /c "cmd /c del /f @path" 2· Windows MySQL timing backup @Echo OFFset "Ymd=%date:~,4%%date:~5,2%%date:~8,2%"(set "Ymd=%date:~,4%%date:~5,2%%date:~8,2%%date:~11,2%%date:~14,2%"Write from the year, month, month and day) C: \ mysql \ bin \ mysqldump--opt -u root --password=123456-H IP BBS> D: \ db_backup \ BBS_%YMD%.sql (If the environment variable configuration is good, there will be no absolute path before mysqldump, otherwise after the execution is executed .sql file is 0KB, mysqldump --opt = u root-p ) @echo on 3· Windows timing backup folder @Echo OFF Xcopy"C:\a" "D:\b" /e/I/d/h/r/y exit 4· Remote backup @Echo OFF Echo is copying the host 192.168.0.2"a"The contents of the folder to"D:\b"Folder ... Xcopy"\\192.168.0.2\a" "D:\b" /e/I/d/h/r/y exit 5· All are stored into .bat files, set plan tasks, and make time.6· Restore database backup file:1)mysql -u root -P (log in MySQL)2) Source file position \ File name (*.sql file)7· Linux file backup to Windows local E: CD E: \ RedmineData (echo open172. **.**.246-IP address echo ftpredmine -username Echo Redmine -Password Echo Prompt -Interactive Mode Off echo binary -FTP passive transmission to BINARY method transmission echo getdata.tar.gz redmine%date:~,4%%date:~5,2%%date:~8,2%.tar.gz --Get the data.tar.gz under the linux system FTP directory and store it in Z: \ RedMineData named redmine20151015.tar.gz. The date is the current date under Windows echo bye)>ftp_getData.src --In the information in (), the information in the () exists in ftp_getdata.src files FTP-s:ftp_getData.src --Perform FTP commands in ftp_getdata.src file echo%Date%Redmine data and attachment backup success! Time:%Time%>> ftp.log --Store backup success information in ftp.log forfiles/p"Z:\redminedata" /m *.tar.gz/d -7 /c "cmd /c del @path" -FORFILES /P file position /s /m file format *.sql /bat /psc /d -days /c *cmd /c del /[email protected]
Reprinted: https://www.cnblogs.com/mzlb520/p/9530790.html