BAT(备份mysql及打包rar)
- set "Y=%date:~,4%"
- set "m=%date:~5,2%"
- set "d=%date:~8,2%"
- md "D:\mysql_bak\%Y%\%m%"
- "D:\AppServ\MySQL\bin\mysqldump.exe" --defaults-file="D:\appserv\mysql\mysqldump-user.ini" -uroot test > D:\mysql_bak\%Y%\%m%\test_%Y%%m%%d%.sql
- copy D:\mysql_bak\%Y%\%m%\test_%Y%%m%%d%.sql D:\AppServ\www\auto_backup_bat\mysql_test.sql
- start C:\"Program Files"\WinRAR\WinRAR.exe a D:\AppServ\www\auto_backup_bat\web_test.rar_bz D:\AppServ\www
.HTACCESS(限制指定后缀文件,只能指定IP访问)
- <Files ~ ".(sql|rar_bz)$">
- order deny,allow
- deny from all
- allow from 10.64.200.17
- allow from 10.64.8.200
- </Files>
BAT(远程下载)
- set "Y=%date:~,4%"
- set "m=%date:~5,2%"
- set "d=%date:~8,2%"
- md "F:\Auto_download\%Y%\%m%\%d%"
- powershell (new-object System.Net.WebClient).DownloadFile('http://10.64.8.100/auto_backup_bat/mysql_test.sql','F:\Auto_download\%Y%\%m%\%d%\test.sql')
- powershell (new-object System.Net.WebClient).DownloadFile('http://10.64.8.100/auto_backup_bat/web_test.rar_bz','F:\Auto_download\%Y%\%m%\%d%\test.rar')
以上就是mysql备份及rar打包相关关键配置代码的详细内容,更多关于mysql备份及rar打包相关关键配置代码的资料请关注九品源码其它相关文章!