loki1991 Posted October 7, 2012 Group: Members Topic Count: 11 Topics Per Day: 0.00 Content Count: 22 Reputation: 13 Joined: 01/07/12 Last Seen: August 9, 2014 Share Posted October 7, 2012 (edited) Heyho,I stopped my work on any ragnarok server. So this is a small farewell gift.This small scripts can be used as Cronjob (http://en.wikipedia.org/wiki/Cronjob) to decrease you administrative work.You normaly just have to change the config variables.Script 1: Auto RO server restart when crashed(should be started via cronjob every 5 minutes or less) #!/bin/bash ###CONFIG START### SERVER_USER="foo" PATH_TO_RO="/home/bar/rathena/" ###CONFIG END### ERROR=0 if [ "$(ps auxf | grep 'login-server' | grep -v 'grep')" == "" ]; then ERROR=1 fi if [ "$(ps auxf | grep 'char-server' | grep -v 'grep')" == "" ]; then ERROR=1 fi if [ "$(ps auxf | grep 'map-server' | grep -v 'grep')" == "" ]; then ERROR=1 fi if [ $ERROR == 1 ]; then su $SERVER_USER | $PATH_TO_RO/athena-start restart fi Script 2: SQL Backup(should be started every day) #!/bin/bash ###CONFIG START### PATH_TO_BACKUPS="/home/foo/backups" DB_HOST="localhost" DB_USER="foo" DB_PASSWORD="secretpw" WHICH_DATABASES="ragnarok" USER_NAME="foo" USER_GROUP="bar" ###CONFIG END### find -P $PATH_TO_BACKUPS -maxdepth 1 -type f \( -name '*.sql' \) -ctime +15 -exec rm {} \; mysqldump -h$DB_HOST -u$DB_USER -p$DB_PASSWORD --databases $WHICH_DATABASES > $PATH_TO_BACKUPS/$(date +%Y-%m-%d).sql chown $USER_NAME:$USER_GROUP $PATH_TO_BACKUPS/$(date +%Y-%m-%d).sql Script 3: Logs -> History DB 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) Edited January 31, 2014 by loki1991 7 Quote Link to comment Share on other sites More sharing options...
quesoph Posted October 9, 2012 Group: Members Topic Count: 16 Topics Per Day: 0.00 Content Count: 210 Reputation: 10 Joined: 11/20/11 Last Seen: August 23, 2015 Share Posted October 9, 2012 Thank you so much!! Quote Link to comment Share on other sites More sharing options...
imajhaynation Posted January 11, 2013 Group: Members Topic Count: 7 Topics Per Day: 0.00 Content Count: 54 Reputation: 1 Joined: 02/21/12 Last Seen: September 24, 2016 Share Posted January 11, 2013 thankyou more scripts to come bro Quote Link to comment Share on other sites More sharing options...
ekis Posted January 12, 2013 Group: Members Topic Count: 13 Topics Per Day: 0.00 Content Count: 28 Reputation: 0 Joined: 02/17/12 Last Seen: September 28, 2013 Share Posted January 12, 2013 Thank You! Bro.! Quote Link to comment Share on other sites More sharing options...
icabit Posted January 19, 2013 Group: Members Topic Count: 28 Topics Per Day: 0.01 Content Count: 353 Reputation: 70 Joined: 07/14/12 Last Seen: 14 hours ago Share Posted January 19, 2013 (edited) any link for this? Edited January 19, 2013 by icabit Quote Link to comment Share on other sites More sharing options...
Brian Posted January 20, 2013 Group: Members Topic Count: 75 Topics Per Day: 0.02 Content Count: 2223 Reputation: 594 Joined: 10/26/11 Last Seen: June 2, 2018 Share Posted January 20, 2013 All of the Linux shell scripts are in QUOTE boxes in post #1. 1 Quote Link to comment Share on other sites More sharing options...
icabit Posted January 20, 2013 Group: Members Topic Count: 28 Topics Per Day: 0.01 Content Count: 353 Reputation: 70 Joined: 07/14/12 Last Seen: 14 hours ago Share Posted January 20, 2013 ayt ill learn how to do that thx brian Quote Link to comment Share on other sites More sharing options...
GM Henry Posted March 18, 2013 Group: Members Topic Count: 7 Topics Per Day: 0.00 Content Count: 44 Reputation: 9 Joined: 03/07/13 Last Seen: April 12, 2023 Share Posted March 18, 2013 Thanx alot for the sharing! Quote Link to comment Share on other sites More sharing options...
hexor9 Posted April 10, 2013 Group: Members Topic Count: 30 Topics Per Day: 0.01 Content Count: 106 Reputation: 0 Joined: 11/16/11 Last Seen: October 16, 2016 Share Posted April 10, 2013 Script 3: Logs -> History DB(should be started 2 times a month) Quote #!/bin/bashmysqldump -hDBSERVER_IP -uDB_USER -pDB_PASSWORD --compact --no-create-info RAGNAROK_DB atcommandlog branchlog charlog chatlog npclog picklog zenylog > PATH_TO_RO/temp.sqlmysql -hDBSERVER_IP -uDB_USER -pDB_PASSWORD -DRAGNAROK_DB -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 -hDBSERVER_IP -uDB_USER -pDB_PASSWORD -DHISTORY_DB < PATH_TO_RO/temp.sqlrm PATH_TO_RO/temp.sql (before you start this script, you should insert a structure only dump into your history database)how to make crontab by here * * * * * (before you start this script, you should insert a structure only dump into your history database) and also this HOW Quote Link to comment Share on other sites More sharing options...
loki1991 Posted January 31, 2014 Group: Members Topic Count: 11 Topics Per Day: 0.00 Content Count: 22 Reputation: 13 Joined: 01/07/12 Last Seen: August 9, 2014 Author Share Posted January 31, 2014 Now the "markers" are variables. Quote Link to comment Share on other sites More sharing options...
Brave Posted May 5, 2014 Group: Members Topic Count: 30 Topics Per Day: 0.01 Content Count: 208 Reputation: 11 Joined: 05/31/12 Last Seen: May 15, 2016 Share Posted May 5, 2014 Now the "markers" are variables. hello how would i apply this? i haven't done any cronjobs and as i see the comment it is really good can you teach me how? Quote Link to comment Share on other sites More sharing options...
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.