BAT代码
@ECHO OFF
for %%i in (%0) do (set "name=%%~ni")
title %name%
set targetsql="%~dp0\firadio3324"
mkdir %targetsql% 2>NUL
ECHO ======Start=======
SET config= --defaults-file=%~dp0\my.ini --single-transaction
"%~dp0\..\mysqldump.exe" %config% firadio_ucenter>%targetsql%\firadio_ucenter-all.sql
"%~dp0\..\mysqldump.exe" %config% firadio_yun_agent>%targetsql%\firadio_yun_agent-all.sql "%~dp0\..\mysqldump.exe" %config% --no-data firadio_uc>%targetsql%\firadio_uc-nodata.sql
"%~dp0\..\mysqldump.exe" %config% --no-create-info --ignore-table=firadio_uc.uc_qq_msg_group --ignore-table=firadio_uc.uc_qq_msg_group_send --ignore-table=firadio_uc.uc_qq_msg_pri --ignore-table=firadio_uc.uc_qq_msg_pri_send --ignore-table=firadio_uc.uc_qq_base --ignore-table=firadio_uc.uc_session firadio_uc>%targetsql%\firadio_uc-data.sql "%~dp0\..\mysqldump.exe" %config% --no-data firadio_yun>%targetsql%\firadio_yun-nodata.sql
"%~dp0\..\mysqldump.exe" %config% --no-create-info --ignore-table=firadio_yun.yun_ntuser_process_hour --ignore-table=firadio_yun.yun_ntuser_process_log --ignore-table=firadio_yun.yun_sensor_log --ignore-table=firadio_uc.yun_location_trace --ignore-table=firadio_uc.yun_ntuser_signin firadio_yun>%targetsql%\firadio_yun-data.sql ECHO ======End=======
set "Ymd=%date:~,4%%date:~5,2%%date:~8,2%"
set h=%time:~0,2%
set h=%h: =0%
set "His=%h%%time:~3,2%%time:~6,2%"
echo %Ymd%%His%
mkdir "%~dp0\xz" 2>NUL
"%~dp0\..\7z.exe" a -ttar %targetsql%.tar %targetsql%
"%~dp0\..\7z.exe" a -txz "%~dp0\xz\%Ymd%%His%.tar.xz" %targetsql%.tar
ECHO ======Finish=======
my.ini
[mysql]
host=mysql.vegan365.xyz
port=3306
user=firadio
password=*******
default-character-set=utf8 [mysqldump]
host=vps.firadio.net
port=3324
user=adm-ro
password=********
default-character-set=utf8