137 lines
3.8 KiB
Plaintext
137 lines
3.8 KiB
Plaintext
## Provide the permissions before running the script:
|
|
chmod u+x *.py *.sh
|
|
|
|
# Note: It's totally dynamic symlinked, so every place you put them is fine
|
|
|
|
|
|
### MYSQL BACKUPS
|
|
## Setup the Mysql backup:
|
|
|
|
# Edit baks/db/Makefile the following things:
|
|
|
|
MY_HOST = localhost
|
|
MY_USER = root
|
|
MY_PASS = password
|
|
|
|
OUTPATH = . # output folder by default (.=current)
|
|
|
|
## Other things
|
|
|
|
# Make manual backups
|
|
cd baks/db/
|
|
make dump
|
|
|
|
# Clean all the backups
|
|
cd baks/db/
|
|
make clean
|
|
|
|
# Setup automatic backups every hour pasting this inside the system file /etc/crontab (the path must be correct!)
|
|
0 * * * * root make -C /home/metin2/baks/db dump
|
|
|
|
# Setup automatic backups cleaning every week pasting this inside the system file /etc/crontab (the path must be correct!)
|
|
0 0 * * 1 root make -C /home/metin2/baks/db wclean
|
|
|
|
## Recovery from backup
|
|
cd baks/db/
|
|
# rename the specific backups as account.sql.gz common.sql.gz log.sql.gz player.sql.gz inside the folder
|
|
make recovery
|
|
|
|
|
|
### FS BACKUPS
|
|
## Setup the FS backup:
|
|
|
|
# Edit baks/fs/Makefile the following thing:
|
|
FOLD = srv1 #metin2 folder generated by gen.py
|
|
OUTPATH = . #output folder by default (.=current)
|
|
|
|
|
|
# Make manual backups
|
|
cd baks/fs/
|
|
make dump
|
|
|
|
# Clean all the backups
|
|
cd baks/fs/
|
|
make clean
|
|
|
|
# Setup automatic backups every hour pasting this inside the system file /etc/crontab (the path must be correct!)
|
|
0 * * * * root make -C /home/metin2/baks/fs dump
|
|
|
|
# Setup automatic backups cleaning every week pasting this inside the system file /etc/crontab (the path must be correct!)
|
|
0 0 * * 1 root make -C /home/metin2/baks/fs wclean
|
|
|
|
## Recovery from backup
|
|
cd baks/fs/
|
|
# rename the specific backup as mt2.tgz inside the folder
|
|
make recovery
|
|
|
|
|
|
### How to generate the server structure:
|
|
## Set up gen_settings.py
|
|
# The M2CONFIG table contains all the values that will be used for every db/conf.txt, and game/Config
|
|
# Be free to edit them as you want
|
|
|
|
## Generate all:
|
|
python admin_panel.py gen
|
|
|
|
# Note: You can run gen.py even if the metin2 server is running just to refresh the config files
|
|
|
|
|
|
### How to manage the server (manually):
|
|
## To start the server:
|
|
python admin_panel.py start
|
|
|
|
## To stop the server:
|
|
python admin_panel.py stop
|
|
|
|
## To clear the logs:
|
|
python admin_panel.py clear
|
|
|
|
|
|
### Additional notes:
|
|
|
|
## To run specific channels and cores
|
|
python admin_panel.py starti
|
|
|
|
## Run a daemon script to keep up all the processes always on:
|
|
python admin_panel.py startall
|
|
|
|
## Stop the daemon script
|
|
python admin_panel.py stopall
|
|
|
|
## Start the processes specifying IP (-I) and LOG_LEVEL (-l)
|
|
python start.py -I 127.0.0.1 -l 1
|
|
|
|
## Forcefully stop all the processes (-l SIGNAL_LEVEL)
|
|
python stop.py -l 9
|
|
|
|
|
|
### Common Issues/Notes
|
|
|
|
# The daemon scripts will run all the processes, so you can't select which channels/cores to run
|
|
|
|
# Don't use the `stopi` option so far.
|
|
|
|
# start.list and clear.list are json files generated by gen.py; don't touch them
|
|
|
|
# ipfw.rules is created by the gen.py; don't use it if you don't know how to implement it
|
|
|
|
# /etc/crontab is a file system used for automatic tasks; Every edit becomes already valid the moment you add it in the file (i won't explain its parsing)
|
|
|
|
# the stop script will wait for all the game processes to be closed (it's usually not more than 300 seconds) before killing db so that all the items/etc will be safely saved even without doing /shutdown in game
|
|
|
|
|
|
### IPFW RULES IMPLEMENTATION (you will be locked out of your server if you fuck up something)
|
|
## Add in /etc/rc.conf
|
|
# Firewall
|
|
firewall_enable="YES"
|
|
firewall_type="open"
|
|
firewall_script="/path/of/your/ipfw.rules"
|
|
firewall_logging="YES"
|
|
|
|
## Restart the ipfw service
|
|
service ipfw restart
|
|
|
|
## Important Notes
|
|
# Be sure to save the ipfw.rules without \r\n lines but only \n lines; Notepad++ -> Edit -> EOL Conversion -> UNIX Format (LN \n)
|
|
# Be sure to save the ipfw.rules as ANSI; Notepad++ -> Format -> Convert to ANSI
|