113 lines
4.1 KiB
Markdown
113 lines
4.1 KiB
Markdown
# 7 Days To Die Game Server Linux Scripts
|
|
A set of opinionated scripts used to manage 7 days to die.
|
|
|
|
# Table of Contents
|
|
[TOC]
|
|
|
|
# Features
|
|
- Xml linting when starting a server:
|
|
![Linting](./Media/Linting.gif)
|
|
This avoids issues where a server fails to start with no apparent reason in the logs, mostly due to
|
|
xml parsing errors not properly reported by 7 Days to Die Servers. Requires `xmllint` to be installed.
|
|
|
|
- Automated backups of configurations on start:
|
|
![Configuration Backup](./Media/Conf-Backup.gif)
|
|
This helps to maintain shorter term backups locally to quickly revert changes made start to start on the server.
|
|
|
|
- Automatic restart handling on server crash:
|
|
![Until-Loop-Crash](./Media/Until-Crash.gif)
|
|
When a server crash is detected the server is automatically restarted after 60 seconds, this is managed internally
|
|
by the script so when you shut down the server explicitly it doesn't start again until told to. Goodbye cronjob!
|
|
|
|
- Sane handling of default paths:
|
|
![Sane Paths](./Media/Sane-Path.gif)
|
|
Instead of the default 7 Days to Die linux behavior of using `~/.local/share/7DaysToDie/` for all saves and serveradmin.xml
|
|
configurations, this script overrides the path to be local to the given server. This makes management and configuration
|
|
vastly easier.
|
|
- And more...
|
|
|
|
# Automatic Installation
|
|
Must be run as `root` or a user with access to `sudo`. This script creates or modifies an existing user of the
|
|
name `sdtd` to install the scripts to their path. If this is not acceptable, then see the [Requirements](#Requirements)
|
|
section. You'll need to install the programs listed there, then git clone this repository and deploy the
|
|
top level scripts in the `Scripts` directory.
|
|
|
|
```bash
|
|
bash -c "$(curl https://gitlab.orion-technologies.io/game-servers/7-days-to-die/-/raw/Development/install.bash)"
|
|
```
|
|
|
|
See [defaults](#defaults) next to find out which ports to open.
|
|
|
|
# Requirements
|
|
- Required
|
|
- [tmux](https://github.com/tmux/tmux)
|
|
- Used to run servers in detached sessions
|
|
- [steamcmd](https://developer.valvesoftware.com/wiki/SteamCMD)
|
|
- Used to install 7 days to die game servers
|
|
- Important, this MUST be in your PATH variable.
|
|
This script calls the [general](https://gitlab.orion-technologies.io/game-servers/general)
|
|
installer script which configures steamcmd to be in `/usr/local/bin`.
|
|
If this is not in your path, the deployed scripts will ***NOT*** work.
|
|
|
|
- Optional
|
|
- [pv](https://github.com/icetee/pv)
|
|
- Used to show progress for backup operations
|
|
|
|
# Defaults
|
|
By default all servers start at an offset of 50000 + server id. For instance, if you were to start `Server-1`,
|
|
the server id would be 1. As such the port `Server-1` would run on is 50001, `Server-2` would be 50002, and so on.
|
|
|
|
By default, the base directory for all servers to be installed to is `~/7-Days-To-Die`.
|
|
|
|
# Usage
|
|
Switch to the `sdtd` user and source `.bash_profile` in order to use these scripts assuming automatic installation has
|
|
been used.
|
|
|
|
Basic usage:
|
|
- Installing a server
|
|
```bash
|
|
7D2D-Manage install -s 1
|
|
```
|
|
this would install `Server-1` if it didn't exist
|
|
- Starting a server
|
|
```bash
|
|
7D2D-Manage start -s 1
|
|
```
|
|
this would start `Server-1`.
|
|
- Stopping a server
|
|
```bash
|
|
7D2D-Manage kill -s 1
|
|
```
|
|
this would stop `Server-1`
|
|
- Updating a server
|
|
```bash
|
|
7D2D-Manage update -s 1
|
|
```
|
|
this would update `Server-1`
|
|
- Getting a backup archive of a server
|
|
```bash
|
|
7D2D-Manage backup -s 1
|
|
```
|
|
this would backup `Server-1`
|
|
- List installed and running servers
|
|
```bash
|
|
7D2D-Manage list -r
|
|
```
|
|
this would list running servers
|
|
```bash
|
|
7D2D-Manage list -i
|
|
```
|
|
this would list installed servers, note that this only checks if the server directory exists, not if any
|
|
server files exist within the directory itself
|
|
|
|
To learn more usage, pass -h to any option, e.g. to get base options:
|
|
```bash
|
|
7D2D-Manage -h
|
|
```
|
|
and to get, for instance, start options:
|
|
```bash
|
|
7D2D-Manage start -h
|
|
```
|
|
|
|
See the [wiki](https://gitlab.orion-technologies.io/game-servers/7-days-to-die/-/wikis/home) for details.
|