If you have the logs and ragnarok tables in the same database, you can may think of archive some of old logs to another database. (should be started 2 times a month)
#!/bin/bash
###CONFIG START###
PATH_TO_RO="/home/bar/rathena"
DB_HOST="localhost"
DB_USER="bar"
DB_PASSWORD="secretpw"
DB_RAGNAROK_DATABASE="ragnarok"
DB_LOG_DATABASE="ragnarok-log"
###CONFIG END###
mysqldump -h$DB_HOST -u$DB_USER -p$DB_PASSWORD --compact --no-create-info $DB_RAGNAROK_DATABASE atcommandlog branchlog charlog chatlog npclog picklog zenylog > $PATH_TO_RO/temp.sql
mysql -h$DB_HOST -u$DB_USER -p$DB_PASSWORD -D$DB_RAGNAROK_DATABASE -e"DELETE FROM atcommandlog WHERE 1=1; DELETE FROM branchlog WHERE 1=1; DELETE FROM charlog WHERE 1=1; DELETE FROM chatlog WHERE 1=1; DELETE FROM npclog WHERE 1=1; DELETE FROM picklog WHERE 1=1; DELETE FROM zenylog WHERE 1=1;"
mysql -h$DB_HOST -u$DB_USER -p$DB_PASSWORD -D$DB_LOG_DATABASE < $PATH_TO_RO/temp.sql
rm $PATH_TO_RO/temp.sql
(before you start this script, you should insert a structure only dump into your history database)
I hope this may help you and the config is understandable.
Greetings, Loki1991(before you start this script, you should insert a structure only dump into your history database)
Question
Brave
BUMP BUMP!
0 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.