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

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

Reply
 
Thread Tools Display Modes
  #1  
Old 12-16-2013, 03:59 PM
provocating's Avatar
provocating
Demi-God
 
Join Date: Nov 2007
Posts: 2,175
Default Making a backup

One thing I really try to do is make sure my server is up and running and that I have backups. It is not a perfect world and there are malicious people out there so I try to protect myself. I use a modified version of this script, mine backs up my forum, joomla and other things. This shoots off an email of the smaller tables to my email, it makes me sleep better knowing my characters are backed up in three total locations. I think I got all the user tables with this, so I want to give back to the community when I can. To use the email portion you will have to have your postfix right with mutt installed.

Code:
TMP_DIR="/tmp"
EMAIL_ADDR="user@mail.com"
MYSQL_PEQ_DB="peq"
MYSQL_LOGIN_DB="logindb"
MYSQL_HOST="127.0.0.1"
MYSQL_USER="root"
MYSQL_PASS="password"
BACKUP_PATH=/mnt/nas1/Backups
EQEMU_DIR=/home/eqemu
WWW_DIR=/var/www

echo ""

echo "Dumping user Tables to $TMP_DIR/peq_user_tables.sql"

mysqldump -u $MYSQL_USER -p$MYSQL_PASS $MYSQL_PEQ_DB aa_timers account account_flags account_ip account_rewards adventure_details adventure_members adventure_stats Banned_IPs bugs buyer char_recipe_list character_ character_activities character_alt_currency character_backup character_buffs character_enabledtasks character_pet_buffs character_pet_info character_pet_inventory character_tasks chatchannels completed_tasks discovered_items eventlog faction_values friends gm_ips group_id group_leaders guilds guild_bank guild_ranks guild_relations guild_members hackers instance_lockout_player inventory item_tick keyring launcher_zones lfguild mail merchantlist_temp name_filter object_contents petitions player_corpses player_corpses_backup player_titlesets qs_player_move_record qs_player_move_record_entries qs_player_npc_kill_record qs_player_npc_kill_record_entries qs_player_speech qs_player_trade_record qs_player_trade_record_entries qs_merchant_transaction_record qs_merchant_transaction_record_entries qs_player_delete_record qs_player_delete_record_entries qs_player_handin_record qs_player_handin_record_entries quest_globals raid_details raid_members reports respawn_times sharedbank spell_globals timers trader trader_audit zone_flags commands launcher rule_sets rule_values variables > $TMP_DIR/peq_user_tables.sql

echo "Compressing user SQL files to $TMP_DIR/peq_user_tables.tar.gz"
tar -czPf $TMP_DIR/peq_user_tables.tar.gz $TMP_DIR/peq_user_tables.sql 

echo "Emailing user backup file to $EMAIL_ADDR"
echo "EqEmu User Backup" | mutt -s "EqEmu User Backup" -a $TMP_DIR/peq_user_tables.tar.gz -- $EMAIL_ADDR 

echo ""

echo "Dumping logindb tables to $TMP_DIR/login_db.sql"
mysqldump -u $MYSQL_USER -p$MYSQL_PASS $MYSQL_LOGIN_DB tblLoginServerAccounts tblServerAdminRegistration tblServerListType tblWorldServerRegistration > $TMP_DIR/login_db.sql 

echo "Compressing logindb SQL files to $TMP_DIR/login_db.tar.gz"
tar -czPf $TMP_DIR/login_db.tar.gz $TMP_DIR/login_db.sql 

echo "Emailing logindb backup file to $EMAIL_ADDR"
echo "EqEmu LoginDb Backup" | mutt -s "EqEmu LoginDb Backup" -a $TMP_DIR/login_db.tar.gz -- $EMAIL_ADDR 

echo "" 
echo ">>> File level backup <<<"
echo ""

echo "Full PEQ sql dump"
mysqldump --routines -u $MYSQL_USER -p$MYSQL_PASS $MYSQL_PEQ_DB > $TMP_DIR/peq.sql 

echo "Compressing Files to remote locations"
tar -cvzPf $BACKUP_PATH/`date +\%Y\%m\%d`.tar.gz $EQEMU_DIR $WWW_DIR $TMP_DIR/*.sql 

echo "Cleaning up files"
rm -r $TMP_DIR/peq_user_tables.sql
rm -r $TMP_DIR/peq_user_tables.tar.gz
rm -r $TMP_DIR/login_db.sql
rm -r $TMP_DIR/login_db.tar.gz
rm -r $TMP_DIR/peq.sql
Anyway, modify at will and if you see problems post them back here so I can fix mine
Reply With Quote
Reply


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 08:55 PM.


 

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