Go Back   EQEmulator Home > EQEmulator Forums > Support > Support::Windows Servers

Support::Windows Servers Support forum for Windows EQEMu users.

Reply
 
Thread Tools Display Modes
  #1  
Old 09-21-2018, 11:11 AM
irongut_av's Avatar
irongut_av
Fire Beetle
 
Join Date: Sep 2018
Posts: 20
Default Automatic compressed mysql backups using batch file and windows task scheduler

If you do not have an automated MySQL backup on windows and would like to set them up, here is a good starting point:


Create a batch file (example: db_backup.bat) and open it up in your favorite editor. Paste the following contents below, replacing the directory structure, dbname, user and password as needed.
Code:
@echo off
for /f "tokens=2 delims==" %%a in ('wmic OS Get localdatetime /value') do set "dt=%%a"
set "YY=%dt:~2,2%" & set "YYYY=%dt:~0,4%" & set "MM=%dt:~4,2%" & set "DD=%dt:~6,2%"
set "HH=%dt:~8,2%" & set "Min=%dt:~10,2%" & set "Sec=%dt:~12,2%"

set "fullstamp=%YYYY%-%MM%-%DD%_%HH%-%Min%-%Sec%"

"C:\Program Files\MariaDB 10.0\bin\mysqldump.exe" -uroot -ppassword peq > C:\eqemu\backups\peq_%fullstamp%.sql

"C:\Program Files (x86)\WinRAR\rar.exe" a -df C:\eqemu\backups\peq_%fullstamp%.rar C:\eqemu\backups\peq_%fullstamp%.sql
Save the file and test it. If the directory location is correct, as well as your MySQL credentials, you should have a compressed backup of your database in the EQEMU/backups folder. Note: the .sql file generated by the MySQL dump will be deleted after being compressed because of the -df option for rar.exe

Next, open up the windows task scheduler and create a new task that calls this batch file. Set the schedule preference (daily, hourly, etc) and starting time.
Reply With Quote
  #2  
Old 09-21-2018, 03:06 PM
Akkadius's Avatar
Akkadius
Administrator
 
Join Date: Feb 2009
Location: MN
Posts: 2,071
Default

Just FYI

Code:
perl eqemu_server.pl backup_database_compressed
Will do the same thing for you

https://github.com/EQEmu/Server/wiki...nance-commands
Reply With Quote
  #3  
Old 09-21-2018, 04:01 PM
irongut_av's Avatar
irongut_av
Fire Beetle
 
Join Date: Sep 2018
Posts: 20
Default

Thanks, that's makes things even easier.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 05:50 AM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3