Page 1 of 1

Server backup tool ?

Posted: Mon Jul 20, 2009 8:57 am
by Menuval
Hello,

was wondering if there is any tool around that helps backing up server files/database ? like an automated schedueled one.
Thanks,

Re: Server backup tool ?

Posted: Mon Jul 20, 2009 12:51 pm
by lishawj
Menuval wrote:Hello,

was wondering if there is any tool around that helps backing up server files/database ? like an automated schedueled one.
Thanks,
If you are using a Windows server then I have two suggestions for you:


1. Write up a simple batch file to dump the entire MySQL (L2JDB) database to a text file, then using Scheduled Task to set up automated backup.

2. Write up another simple batch file to copy the MySQL data folder from All User folder, then using Scheduled Task to setup up automated backup.

Re: Server backup tool ?

Posted: Mon Jul 20, 2009 2:20 pm
by janiii
i have done this in the startGameServer.bat file, so that my server got backuped on each restart. just an idea.

Re: Server backup tool ?

Posted: Mon Jul 20, 2009 3:30 pm
by Menuval
using linux centos server ><

Re: Server backup tool ?

Posted: Mon Jul 20, 2009 3:51 pm
by janiii
the same for the .sh script. only add sqldump to the restart part or wherever you want to do the backup.

Re: Server backup tool ?

Posted: Mon Jul 20, 2009 4:25 pm
by Menuval
can you give an example please?

Re: Server backup tool ?

Posted: Tue Jul 21, 2009 9:08 pm
by nonom
For example, each update I upload datapack and gameserver in separated files (.zip) using build.xml Ant task from Eclipse.

On live server, for example, we have a home user directory:

Code: Select all

/home/l2jserver/
Well, we can use a couple of extra directories for deploy:

Code: Select all

/home/l2jserver/opt//home/l2jserver/build/

In /opt/ i usually have a build.sh that remove old files and backup important files, cron execute it each sunday. In /build/ directory i have my hexid.txt and some script.sql or properties to save (olys), my geodata/pathnode files, and more.

This is a simple bash script (custom) only an example:

build.sh

Code: Select all

 #!/bin/sh # backup last logs files (maybe you need to check this later..)cp -rf /home/l2jserver/gameserver/log/ /home/l2jserver/opt/ # backup for olympiad.properties to restore it after updatecp -rf /home/l2jserver/gameserver/config/olympiad.properties /home/l2jserver/build/ # backup crests clans to restore it after updatecp -rf /home/l2jserver/gameserver/data/crests/ /home/l2jserver/opt/ # I have some modifications in LoginServer_loop.sh and i want to save this file also (optional for me)cp -rf /home/l2jserver/login/LoginServer_loop.sh /home/l2jserver/build/ # And.. all you need# -- here -- # Now,.. clean all filesrm -rf /home/l2jserver/gameserverrm -rf /home/l2jserver/libsrm -rf /home/l2jserver/languagesrm -rf /home/l2jserver/loginrm -rf /home/l2jserver/sqlrm -rf /home/l2jserver/toolsrm -rf /home/l2jserver/docrm -rf /home/l2jserver/imagesrm -rf /home/l2jserver/configrm -rf /home/l2jserver/*.txtrm -rf /home/l2jserver/*_lIC*rm -rf /home/l2jserver/*.html #Well.. now we can extract our updated server in same placeunzip -o -q /home/l2jserver/build/L2J_Server.zip -d ..unzip -o -q /home/l2jserver/build/L2J_DataPack.zip -d .. #We need to restore our important info (geodata included)cp -rf /home/l2jserver/build/geodata /home/l2jserver/gameserver/datacp -rf /home/l2jserver/build/pathnode /home/l2jserver/gameserver/datacp -rf /home/l2jserver/build/olympiad.properties /home/l2jserver/gameserver/configcp -rf /home/l2jserver/build/LoginServer_loop.sh /home/l2jserver/login/cp -rf /home/l2jserver/build/hexid.txt /home/l2jserver/gameserver/configcp -rf /home/l2jserver/build/chmod 750 /home/l2jserver/login/*.shchmod 750 /home/l2jserver/gameserver/*.sh # clean not important (for me) filesrm -rf /home/l2jserver/*.txtrm -rf /home/l2jserver/*_LIC*rm -rf /home/l2jserver/*.html # clean -_- windows files =Prm -rf /home/l2jserver/gameserver/*.batrm -rf /home/l2jserver/gameserver/*.exerm -rf /home/l2jserver/login/*.batrm -rf /home/l2jserver/login/*.exe # backup for mysql with dumpsmysqldump -u l2jserver -ppasswordhere --database yourdatabase > /home/l2jserver/opt/backup.sql #I have a empty script.sql.. to apply some sql scripts if is neccessary after updatemysql -u l2jserver -ppasswordhere --database yourdatabase < /home/l2jserver/opt/script.sql  
Now maybe will need to update some sql files, normally I like to do it manually

Well , now open your cron manager with

Code: Select all

crontab -e
Add your build.sh and you can execute a similar batch script to backup and restore your files at 00:00 on Sunday.

Code: Select all

0 0 * * 0 /home/l2jserver/opt/build.sh
Remember to give privs

Code: Select all

chmod 750 /home/l2jserver/opt/build.sh
Note: Its only an example, its means you need to have same files in same directories as my example , build a couple of extra dirs, and write a build.sh. This step-by-step script is only for learning purposes, isnt a production script but it can give you a idea :)

You can add an automatic restart, update, package, all you need :)

Im using Debian Lenny 5.0+

Re: Server backup tool ?

Posted: Wed Jul 22, 2009 4:57 am
by Deadmeat
I used Navicat to do scheduled backups automatically every 12 hours, I know SQL dumbs are fasters to restore but it's a lot easyer to just click a checkbox on the talbes you want to restore and not have to take the time to make a script to do it for you, I used a Windows XP Pro computer that was on the same LAN as the servers so I don't know if this would be a good idea to use over the Internet if your servers are hosted by someone else and not yourself.

Re: Server backup tool ?

Posted: Wed Jul 22, 2009 6:02 am
by lishawj
Deadmeat wrote:I used Navicat to do scheduled backups automatically every 12 hours, I know SQL dumbs are fasters to restore but it's a lot easyer to just click a checkbox on the talbes you want to restore and not have to take the time to make a script to do it for you, I used a Windows XP Pro computer that was on the same LAN as the servers so I don't know if this would be a good idea to use over the Internet if your servers are hosted by someone else and not yourself.
The backup feature is only available on the paid versions of NaviCat but writing up a short scripts is an alternative to paying for the paid versions. In fact, the script I wrote took all but 5 minutes to write, then another 2 minutes to set up 2 backup per day using Scheduled Tasks.

Re: Server backup tool ?

Posted: Fri Jul 24, 2009 5:14 pm
by Deadmeat
I had the paid version so why not use what I paid for but if your not looking to spend the money on Navicat then yeah it does not take long to backup and restore the whole database, little more work to restore one table but the post is about backing up the whole server in which case your way will work fine.