View Single Post
  #4  
Old 05-13-2018, 02:08 AM
Anon.GM's Avatar
Anon.GM
Fire Beetle
 
Join Date: Apr 2018
Posts: 19
Default

One thing I don't see much on is backups. I have this bat file running twice a day. Use Windows tasks if your running a Windows server to schedule the bat file to run. It uses 7 zip to compress the files so you need that installed too.

Code:
@echo off

 set dbUser=root
 set dbPassword=eqemu
 set backupDir="C:\EQEmuServer\backups\"
 set mysqldump="C:\Program Files\MariaDB 10.0\bin\mysqldump.exe"
 set mysqlDataDir="C:\Program Files\MariaDB 10.0\data"
 set zip="c:\Program Files\7-Zip\7z.exe"

  :: get date
 for /F "tokens=2-4 delims=/ " %%i in ('date /t') do (
      set yy=%%i
      set mon=%%j
      set dd=%%k
 )

 :: get time
 for /F "tokens=5-8 delims=:. " %%i in ('echo.^| time ^| find "current" ') do (
      set hh=%%i
      set min=%%j
 )

 echo dirName=%yy%%mon%%dd%_%hh%%min%
 set dirName=%yy%%mon%%dd%_%hh%%min%
 
 :: switch to the "data" folder
 pushd %mysqlDataDir%

 :: iterate over the folder structure in the "data" folder to get the databases
 for /d %%f in (*) do (

 if not exist %backupDir%\%dirName%\ (
      mkdir %backupDir%\%dirName%
 )

 %mysqldump% --host="localhost" --user=%dbUser% --password=%dbPassword% --max_allowed_packet=512M --routines %%f > %backupDir%\%dirName%\%%f.sql

 %zip% a -tgzip %backupDir%\%dirName%\%%f.sql.gz %backupDir%\%dirName%\%%f.sql

 del %backupDir%\%dirName%\%%f.sql
 )
 popd
I'm not sure what level of help you need so I'm just posting what I have. Also passwords may need to be changed if your using anything outside the standard.
__________________
email:anon.gm@protonmail.com
servers: Anon (bots) and Anon (solo)
Reply With Quote