This repository contains scripts for managing the 2011Scape game server and file server. The scripts are installed in the /opt/2011Scape
directory.
Before using these scripts, you need to install the following dependencies:
sudo apt update
sudo apt install openjdk-11-jdk -y
sudo mkdir /opt/gradle
sudo wget https://services.gradle.org/distributions/gradle-7.2-bin.zip -P /tmp
sudo unzip -d /opt/gradle /tmp/gradle-7.2-bin.zip
sudo ln -s /opt/gradle/gradle-7.2/bin/gradle /usr/bin/gradle
sudo apt install git -y
- Clone the server management repository with the
--recursive
option to automatically initialize and clone the submodules:
sudo git clone --recursive https://github.com/2011Scape/2011scape-linux-server-management.git /opt/2011Scape
- Ensure that the scripts are executable by running the following command:
sudo chmod +x /opt/2011Scape/*.sh
To start the game server, run the game-server.sh
script:
/opt/2011Scape/game-server.sh
This script will start a new screen
session named "game-server" and run the game server in that session. The game server will be started in the /opt/2011Scape/game/
directory, and the ./gradlew game:run build -x test
command will be executed.
To start the file server, run the file-server.sh
script:
/opt/2011Scape/file-server.sh
This script will start a new screen
session named "file-server" and run the file server in that session. The file server will be started in the /opt/2011Scape/file-server/
directory, and the ./gradlew run
command will be executed.
To update the game server, follow these steps:
- Run the
backup.sh
script to create a backup of the player files, cache, and xteas:
/opt/2011Scape/backup.sh
- Run the
update-game.sh
script to update the game server:
/opt/2011Scape/update-game.sh
This script will attempt to compile the updated game server code. If there are any issues with compiling, follow these steps:
- Remove the existing
game
directory:
sudo rm -rf /opt/2011Scape/game
- Re-clone the
game
submodule:
cd /opt/2011Scape
sudo git submodule update --init --recursive
- Run the
restore.sh
script to restore the player files, cache, and xteas from the backup:
/opt/2011Scape/restore.sh
- The
restart.sh
script will run automatically after a successful update to restart the game server.
To restart the game server manually, run the restart.sh
script:
/opt/2011Scape/restart.sh
This script will check if a screen
session named "game-server" exists. If the session exists, it will send a Ctrl+C
command to gracefully stop the server, wait for 5 seconds, and then kill the session. After terminating the existing session, the script will start a new "game-server" session and run the game server in that session, similar to the game-server.sh
script.
- To attach to the "game-server" or "file-server"
screen
sessions, runscreen -r game-server
orscreen -r file-server
, respectively. - This will allow you to view the output of the servers and interact with them if needed.
- To detach from a
screen
session, pressCtrl+A
followed byCtrl+D
. - If you need to stop the game server or file server manually, attach to the respective
screen
session and send aCtrl+C
command to stop the process gracefully.
Note: These scripts assume that the necessary dependencies and configurations are already in place for running the game server and file server. Make sure to set up the required environments and configurations before using these scripts.