Rolling backups to your local machine

Shibdib

Member
This is what I use on my server. Works GREAT. This is managed server friendly as long as you have access to you database.

--

Necessary programs - MySQL Administrator (Can be found on Softpedia, I can't post links yet), Windows xp/vista/7

--

Steps

1. Install and setup MySQL Administrator and connect to your DB.
2. Go to Tools->Options->General Options and be sure Store Passwords is checked, and the storaged method is obscured.
3. Go to Tools->Manage Connections and ensure your password is there as *** and your DB is the only one listed under connections.
4. Now go to Backup and click New Project. Name your project however you desire and select the DB you wish to backup.
5. Ignore the advanced options and go to the schedule tab. Fill in those settings as you please. I recommend setting the execution time to daily at midnight.
6. Once it's setup to your liking click Save Project, when prompted for a username and password DO NOT USE YOUR DB CREDENTIALS. Use your windows username and password. You MUST have a password enabled on your account.
7. One that is complete you're nearly done, to make it a rolling backup you have a few more steps. Go to your start menu and find Accessories->System Tools->Task Scheduler. In Task Scheduler click the task scheduler library drop down and find your backup event. Right click your event and go to properties, in properties go to the triggers tab and click and edit your trigger. Check the box in advanced settings "Repeat Task Every" and set it to the amount you want and set duration to indef.
8. You now have a rolling backup that will be automatically labeled with date and time by MySQL Admin. To avoid having a backlog of backups next is a .bat that I use to delete files in the backup folder older than 3 days. (This .bat uses the windows feature forfiles, most modern windows have it included but some do not)

create a .bat with the following code. Editing the directory to where your backups are saved.
Code:
forfiles /p "D:\Dayz Backups" /s /d -3 /c "cmd /c del @file : date >= 3 days >NUL"
//
exit

9. Place this file somewhere safe and open the Task Scheduler again. Setup a task to open the .bat every night at midnight indef. and it will auto prune DB backups older than 3 days.


You now have server backups being saved to your local hard drive and being automatically pruned.
 
Nice prune function. :)

I use this .bat file in the BEC scheduler.
Code:
FOR /f "tokens=1-4 delims=/ " %%a in ('date /t') do SET todaysdate=%%c-%%b-%%a
 
FOR /f "tokens=1-6 delims=: " %%a in ('time /t') do SET todaystime=%%a-%%b
 
"T:\Steam\steamapps\common\arma 2 operation arrowhead\server_setup\xampp\mysql\bin\MYSQLdump -u root -p<passwd> --port=3310 --opt --all-databases > Z:\DAYZ\sqlbackups\BlissV1.7.4.4_mysqldump_%todaysdate%_%todaystime%.sql
 
...or a cronjob like:

Code:
0 */1 * * * /usr/local/bin/mysqldump -h hostname -u dbname -pyourpassword --all-databases | gzip -9 -c > /usr/home/cyrq/backups/backup.`date +\%d-\%m-\%Y--\%H:\%M-`.sql.gz
 
...or a cronjob like:

Code:
0 */1 * * * /usr/local/bin/mysqldump -h hostname -u dbname -pyourpassword --all-databases | gzip -9 -c > /usr/home/cyrq/backups/backup.`date +\%d-\%m-\%Y--\%H:\%M-`.sql.gz

Except that looks like its for a local database.. which I specifically said is what this IS NOT for.
 
Local? So your saying that my FreeBSD box runs DayZ? ;)
That command runs mysql dump, connects to DayZ.ST, backups my db, and stores it in a a specified path on my server.

After that i can download any file that i want from my other machine. Also it backups more often then my personal PC.
This command will also suit any *nix/linux user. The mysqldump path may vary.
 
I guess.. still backsup to the server.. the way I posted backups and prunes automatically to your local pc.
 
Back
Top