Jump to content
Sign in to follow this  
blueshiftxd

Database Backup Tool[For Private Hives]

Recommended Posts

Hey guys,

I was preparing to put my server on public, so I wrote this little database backup tool.

Its based off of ShadowDuke's Script, but it is far better as it makes four backups.

It backs up every 30 minutes, but it saves backups up to 2 hours.


README.txt

How to Install:

Copy to any directory, open along-side
with your server start batch file.

What It Does:

Creates the following directories if they don't exist:

"C:\ProgramData\MySQL\MySQL Server 5.5\db_backup"
"C:\ProgramData\MySQL\MySQL Server 5.5\db_backup\db_backup"
"C:\ProgramData\MySQL\MySQL Server 5.5\db_backup\db_backupHourOld"
"C:\ProgramData\MySQL\MySQL Server 5.5\db_backup\db_backup1Hour30MinsOld"
"C:\ProgramData\MySQL\MySQL Server 5.5\db_backup\db_backup2HoursOld"

Once, they're made, the first backup is made.
After 2 hours all 4 folders should contain different databases.

Tested?:

This program was tested on Windows 7 Ultimate 64-bit ONLY.
You can make it compatible with your system by simply downloading the
batch file and customizing the paths.

Credits:

Made by BlueShiftXD.
Based on ShadowDuke's Script.

I am offering a .bat file and an executable .exe file for those who prefer that.

Download the program here: https://github.com/BlueShiftXD/DayZ-Database-Backup-Tool

Share this post


Link to post
Share on other sites

Nice little script, but perhaps try using MySQLDump instead? Less issues that way.

Share this post


Link to post
Share on other sites

Here's how I do it. I'm using forfiles.exe to check on backup files that are older than a day and delete them.

Lets just assume I have forfiles.exe in C: and my backups in a folder called C:\backups and the mysql bin in C:\MySQL.

Make sure that the username and password are written right next to -u or -p. For instance:

-uroot -p1234


@echo off
echo Delete older files...
C:\forfiles.exe /p C:\backups\ /s /m *.sql /d -1 /c "cmd /c del @file"
echo Running DB dump...
C:\MySQL\bin\mysqldump -uUSERNAME -pPASSWORD --result-file="C:\backups\backup.%DATE:~10,4%%DATE:~7,2%%DATE:~4,2%_%time:~0,2%%time:~3,2%%time:~6,2%.sql" hivemind
echo Done!

In this case I named the database hivemind. Which I think is standard for most private hives. You can also play around with the Date settings. A file with that configuration will look like this for instance: backup.20121910_155145

Then put that into a .bat put it anywhere you want and use BEC's scheduler to go execute it.



<job id="888">
<time>010000</time> <!-- run every 1 hour -->
<day>1,2,3,4,5,6,7</day>
<loop>1</loop>
<cmd>C:\Yourbackupbatch.bat</cmd>
<cmdtype>1</cmdtype>
</job>

You can play around with the time of course.

Edited by JaysonX

Share this post


Link to post
Share on other sites

For mysqldump and bliss you have to add --routines to the mysqldump command line, mysql stored procedures are not dumped by default and they are necessary for bliss to run. I don't have any experience with other private hives so I don't know if they use stored procedures or not.

  • Like 1

Share this post


Link to post
Share on other sites

Most def, what you're doing is a horrible way of backing stuff up.

Basically, http://dev.mysql.com.../mysqldump.html is what you want to use.

It's very easy to set up, and just schedule it for every 30 minutes or what time you want.

I'll try that, but my script is working fine for me. Thanks for the suggestion.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×