вторник, 27 марта 2012 г.

Мелкий батничек для бекапа MySQL под вынью.

@echo off
echo Starting Backup of MySql Database

set BackupDir=c:\backups\

for /f "tokens=1-3 delims=. " %%a in ('date /t') do (set dt=%%c-%%b-%%a)
for /f "tokens=1-3 delims=: " %%a in ('echo %time%') do (set tm=%%a.%%b.%%c)

set backupfilename=%dt%_%tm%.sql

echo Backup to file: %backupfilename%

"C:\Program Files\MySQL\MySQL Server 5.5\bin\mysqldump.exe" --routines -u openfire -p72@FR3P openfire > "%BackupDir%openfire-%backupfilename%"
"C:\Program Files\WinRAR\Rar.exe" m -mde -ep "%BackupDir%openfire-%backupfilename%.rar" "%BackupDir%openfire-%backupfilename%"

echo on
echo delete olds files

forfiles /p %BackupDir% /s /m *.* /d -14 /c "cmd /c del @file"

echo Backup Complete!

Комментариев нет: