Marty-v58/serverfiles/main/README-MAIN.txt
2025-03-24 01:17:15 -05:00

141 lines
4.0 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)
### DB BACKUPS
## Setup the DB backup:
# Make manual backups
cd baks/
python backup_db.py dump
# Clean all the backups
cd baks/
python backup_db.py clean
# Setup automatic backups every hour pasting this inside the system file /etc/crontab (the path must be correct!)
0 * * * * root cd /home/metin2/baks/ && /usr/local/bin/python3 backup_db.py dump
# Setup automatic backups cleaning every week pasting this inside the system file /etc/crontab (the path must be correct!)
0 0 * * 1 root cd /home/metin2/baks/ && /usr/local/bin/python3 backup_db.py wclean
## Recovery from backup
cd baks/
python backup_db.py 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/
python backup_fs.py dump
# Clean all the backups
cd baks/
python backup_fs.py clean
# Setup automatic backups every hour pasting this inside the system file /etc/crontab (the path must be correct!)
0 * * * * root cd /home/metin2/baks/ && /usr/local/bin/python3 backup_fs.py dump
# Setup automatic backups cleaning every week pasting this inside the system file /etc/crontab (the path must be correct!)
0 0 * * 1 root cd /home/metin2/baks/ && /usr/local/bin/python3 backup_fs.py wclean
## Recovery from backup
cd baks/
python backup_fs.py 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
## To force stop the server: (kill -9)
python admin_panel.py stop --level 9
python admin_panel.py stop -l 9
python admin_panel.py stop -l9
### 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