点击(此处)折叠或打开


  1. echo ******MySQL backup start********
  2. forfiles /p "D:\bakdb" /m kdyp_*.* -d -30 /c "cmd /c del /f @path"
  3. set "Ymd=%date:~0,4%%date:~5,2%%date:~8,2%_%time:~0,2%%time:~3,2%%time:~6,2%"
  4. E:\mysql-5.7.16-winx64\bin\mysqldump --opt --single-transaction=TRUE --user=root --password=123^= --host=127.0.0.1 --protocol=tcp --port=3306 --default-character-set=utf8 --routines "kdyp" > D:\bakdb\kdyp_%Ymd%.sql
  5. echo ******MySQL backup completed********
  6. ping 127.0.0.1 -n 2 > nul
  7. echo ******zip start********
  8. "C:\Program Files\7-Zip\7z.exe" a kdyp_%Ymd%.zip kdyp_%Ymd%.sql
  9. echo ******zip completed********
  10. ping 127.0.0.1 -n 2 > nul
  11. del kdyp_%Ymd%.sql
  12. echo ******scp start********
  13. "C:\Program Files\PuTTY\pscp.exe" -l root -pw yourpwd -P 22 kdyp_%Ymd%.zip 122.122.122.122:/remote/
  14. echo ******scp completed********
  15. echo on

10-04 03:23