[Utility] Script For Easily Updating Trinitycore Using Linux

I used to use several small scripts to help me keep TrinityCore fully updated, but combined it into a single script and decided to share it with others here, as I hope it might be useful /emoticons/default_smile.png

I made some assumptions as to where the source, build, server etc. directories are located - I followed the excellent WIKI http://www.trinityco…fo/How-to:Linux so if you did it some other way, it might not work out of the box.

It will do the following:

[ul]
[li]download or update the source code[/li]
[li]compile server[/li]
[li]install server[/li]
[li]backup the current “world”, “auth” and “character” databases and gzip them (just in case)[/li]
[li]download latest TDB-file if a newer version than the local one exists[/li]
[li]delete old database-backups[/li]
[li]apply all patches to the “world” database[/li]
[li]apply all custom patches to the world database[/li]
[li]apply patches to the “character” database[/li]
[li]apply patches to the “auth” database[/li]
[li]update maps and vmaps (if tools are updated)[/li]
[li]delete old map-backups[/li]
[/ul]

Tested on Debian Squeeze amd64 and it obviously worked for me - but there is no guarantee it will work for you and it’s not my fault if your server blows up.

Unfortunately I couldn’t attach the file, so instead you have to copy/paste the following into a file, I suggest calling it something like update-trinitycore.sh, then make it executable using chmod +x update-trinitycore.sh and finally run it using sh update-trinitycore.sh.

WARNING: Remember to edit the file, the section at the top, and modify it to your own system!

Feedback is welcome!

Updated 19.01.2012, added “verbose” option and corrected an error with the maps.

Skipped a lot of minor updates, as I’m not sure anyone here even uses it… but anyway:

Updated 15.02.2012, lots of updates - more features added, removed some bugs, made the code a little nicer…

Next time the code should be cleaned up further and features for removing obsolete backups… or whatever I like.

Updated 25.02.2012, updated to vmap4-tools, added the ability to remove old backups and added the auth-database to the script as well.

Next time it might be moving this script to a place with revision control etc. as Nay suggested. Edit a little later: moved to Github, that was easy /emoticons/default_cool.png

Updated 24.03.2012, added the option for custom ACE library path, some minor cleanups.

Latest script can be found here:

https://gist.github.com/1911216

Regards,

Zoidmann

Thanks a lot, very useful!

Looks very nice.

Here’s a little suggestion, create a gist (https://gist.github.com/) for the script. It will work like a tiny repository and it has revisions and stuff like that - nice to see what changed over time.

Thanks for the feedback. There’s a new version of the script available, it should be a nice improvement in functionality compared to the older versions.

@Nay: suggestion noticed, might happen around for the next update /emoticons/default_smile.png

Edit: OK, that was easy… it can now be found here: https://gist.github.com/1911216

[FONT=helvetica]Zoidmann, could you add in the code a variable to set the ACE library path in case not using systemwide ace installation?[/FONT]

[FONT=helvetica]Thanks[/FONT]

@adso

Please try out the latest iteration of the script, I added the option but not sure if it works as intended (as I have it system wide and too lazy to test the other option). Let me know if it works - if not, I can take another go at it /emoticons/default_smile.png

Ok, I will test it. If not, I will give you the piece of code I have added that I know it works.

Can you modify the code to make the script work in new installations?

I compiled without errors, but not sure if because I compiled it before.

Zoidmann, can you modify the script to manage multiple realms? Or at least 2 realms.

Thanks

Sorry for answering to old topic, but I have a problem with that script. When I try make database backup or update it gives me error. “Error 1045: Access denied”

Can someone give me any helpfull tips?

btw. Very nice script thanks!

Hi there,

how would i implement stop & start server into this script, i mean so that if i start your update script it stops the worldserver and authserver then after it updates everything starts both up again. And how about implementing a sql cleanup script also an email notification at the end would be awesome. /emoticons/default_smile.png

Okay i could set up my cron to do most of this but it would be nice to have it wrapped up in one script.

Greetings,

Alex

@Badbull - Dont know if this answer is of any use for you anymore but check your permissions with “ls -l” in the root directory you defined in his script to create the backup files. The permissions of this directory have to be set to the same owner as the user you are running the script with. so if you defined lets say /home/user/ as backup directory you would do a ls -l in /home to see if the folder user has the right permissions. Or just change the path for backupfiles in his script to /home/user>running>script/.