Skip to content

Commit 0cefa4d

Browse files
authored
Merge pull request #135 from MinecraftServerControl/mscs.defaults.v5
New format for defaults file v5
2 parents 32638f5 + f38a3fe commit 0cefa4d

File tree

5 files changed

+360
-112
lines changed

5 files changed

+360
-112
lines changed

Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ MSCS_INIT_D := /etc/init.d/mscs
88
MSCS_SERVICE := /etc/systemd/system/mscs.service
99
MSCS_COMPLETION := /etc/bash_completion.d/mscs
1010

11+
UPDATE_D := $(wildcard update.d/*)
12+
1113
.PHONY: install update clean
1214

1315
install: $(MSCS_HOME) update
@@ -27,6 +29,9 @@ update:
2729
if which systemctl; then \
2830
cp mscs.service $(MSCS_SERVICE); \
2931
fi
32+
@for script in $(UPDATE_D); do \
33+
sh $$script; \
34+
done; true;
3035

3136
clean:
3237
if which systemctl; then \

README.md

Lines changed: 113 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616
* [Creating a new world](#creating-a-new-world)
1717
* [Importing an existing world](#importing-an-existing-world)
1818
* [Renaming world folder](#renaming-world-folder)
19+
* [Adjusting global server properties](#adjusting-global-server-properties)
20+
* [Default global server properties](#default-global-server-properties)
1921
* [Adjusting world properties](#adjusting-world-properties)
2022
* [Default world properties](#default-world-properties)
2123
* [Enabling Forge, BungeeCord, and other server software](#enabling-forge-bungeecord-and-other-server-software)
22-
* [Adjusting global server options](#adjusting-global-server-settings)
23-
* [Configuring MSCS for multiple users](#configuring-mscs-for-multiple-users)
2424
* [Scheduling backups and other tasks](#scheduling-backups-and-other-tasks)
2525
* [Scheduling backups](#scheduling-backups)
2626
* [Removing backups after X days](#removing-backups-after-x-days)
@@ -180,8 +180,9 @@ At first, you probably want to [create a new world](#creating-a-new-world) or
180180

181181
Then, you might want to adjust the
182182
[world properties](#adjusting-world-properties), adjust the
183-
[global server settings](#adjusting-global-server-settings), and enable any other
184-
[server software](#enabling-forge-bungeecord-and-other-server-software) as needed.
183+
[global server properties](#adjusting-global-server-properties), and enable any
184+
other [server software](#enabling-forge-bungeecord-and-other-server-software)
185+
as needed.
185186

186187
### Creating a new world
187188
The command to create a new world is:
@@ -258,12 +259,106 @@ that you wish the world to use:
258259

259260
mscs create vanillaMC 25565
260261

262+
### Adjusting global server properties
263+
Default values in the script can be overridden by adding certain properties to one
264+
of the `mscs.defaults` files. The `mscs.defaults` files can be found found in one
265+
of three places depending on how the script is being used. When using the `mscs`
266+
script, the `mscs.defaults` file can be found at `/opt/mscs/mscs.defaults`. When
267+
using the `msctl` script in [multi-user mode](https://github.com/MinecraftServerControl/mscs/wiki/Configuring-MSCS-for-multiple-users), the `mscs.defaults` file can be found at either `$HOME/mscs.defaults` or `$HOME/.config/mscs/mscs.defaults`.
268+
269+
For more information on the various properties, see the [wiki page](https://github.com/MinecraftServerControl/mscs/wiki/Global-Server-Settings).
270+
271+
The following properties are available:
272+
* mscs-location - Location of the mscs files.
273+
* mscs-worlds-location - Location of world files.
274+
* mscs-versions-url - URL to download the version_manifest.json file.
275+
* mscs-versions-json - Location of the version_manifest.json file.
276+
* mscs-versions-duration - Length in minutes to keep the version_manifest.json file before updating.
277+
* mscs-detailed-listing - Properties to return for detailed listings.
278+
* mscs-default-world - Default world name.
279+
* mscs-default-port - Default Port.
280+
* mscs-default-ip - Default IP address.
281+
* mscs-default-version-type - Default version type (release or snapshot).
282+
* mscs-default-client-version - Default version of the client software.
283+
* mscs-default-client-jar - Default .jar file for the client software.
284+
* mscs-default-client-url - Default download URL for the client software.
285+
* mscs-default-client-location - Default location of the client .jar file.
286+
* mscs-default-server-version - Default version of the server software.
287+
* mscs-default-server-jar - Default .jar file for the server software.
288+
* mscs-default-server-url - Default download URL for the server software.
289+
* mscs-default-server-args - Default arguments to for a world server.
290+
* mscs-default-initial-memory - Default initial amount of memory for a world server.
291+
* mscs-default-maximum-memory - Default maximum amount of memory for a world server.
292+
* mscs-default-server-location - Default location of the server .jar file.
293+
* mscs-default-server-command - Default command to run for a world server.
294+
* mscs-backup-location - Location to store backup files.
295+
* mscs-backup-log - Lcation of the backup log file.
296+
* mscs-backup-duration - Length in days that backups survive.
297+
* mscs-log-duration - Length in days that logs survive.
298+
* mscs-enable-mirror - Enable the mirror option by default for worlds (default disabled).
299+
* mscs-mirror-path - Default path for the mirror files.
300+
* mscs-overviewer-bin - Location of Overviewer.
301+
* mscs-overviewer-url - URL for Overviewer.
302+
* mscs-maps-location - Location of Overviewer generated map files.
303+
* mscs-maps-url - URL for accessing Overviewer generated maps.
304+
305+
The following variables may be used in some of the above properties:
306+
* $JAVA - The Java virtual machine.
307+
* $CURRENT_VERSION - The current Mojang Minecraft release version.
308+
* $CLIENT_VERSION - The version of the client software.
309+
* $SERVER_VERSION - The version of the server software.
310+
* $SERVER_JAR - The .jar file to run for the server.
311+
* $SERVER_ARGS - The arguments to the server.
312+
* $INITIAL_MEMORY - The initial amount of memory for the server.
313+
* $MAXIMUM_MEMORY - The maximum amount of memory for the server.
314+
* $SERVER_LOCATION - The location of the server .jar file.
315+
316+
#### Default global server properties
317+
Below are the default global server properties. You can add one, none, or all
318+
of the properties below to one of the `mscs.defaults` files and adjust it to
319+
your liking.
320+
321+
mscs-location=/opt/mscs
322+
mscs-worlds-location=/opt/mscs/worlds
323+
mscs-versions-url=https://launchermeta.mojang.com/mc/game/version_manifest.json
324+
mscs-versions-json=/opt/mscs/version_manifest.json
325+
mscs-versions-duration=1440
326+
mscs-default-world=world
327+
mscs-default-port=25565
328+
mscs-default-ip=
329+
mscs-default-version-type=release
330+
mscs-default-client-version=$CURRENT_VERSION
331+
mscs-default-client-jar=$CLIENT_VERSION.jar
332+
mscs-default-client-url=https://s3.amazonaws.com/Minecraft.Download/versions/$CLIENT_VERSION/$CLIENT_VERSION.jar
333+
mscs-default-client-location=/opt/mscs/.minecraft/versions/$CLIENT_VERSION
334+
mscs-default-server-version=$CURRENT_VERSION
335+
mscs-default-server-jar=minecraft_server.$SERVER_VERSION.jar
336+
mscs-default-server-url=https://s3.amazonaws.com/Minecraft.Download/versions/$SERVER_VERSION/minecraft_server.$SERVER_VERSION.jar
337+
mscs-default-server-args=nogui
338+
mscs-default-initial-memory=128M
339+
mscs-default-maximum-memory=2048M
340+
mscs-default-server-location=/opt/mscs/server
341+
mscs-default-server-command=$JAVA -Xms$INITIAL_MEMORY -Xmx$MAXIMUM_MEMORY -jar $SERVER_LOCATION/$SERVER_JAR $SERVER_ARGS
342+
mscs-backup-location=/opt/mscs/backups
343+
mscs-backup-log=/opt/mscs/backups/backup.log
344+
mscs-backup-duration=15
345+
mscs-log-duration=15
346+
mscs-detailed-listing=motd server-ip server-port max-players level-type online-mode
347+
mscs-enable-mirror=0
348+
mscs-mirror-path=/dev/shm/mscs
349+
mscs-overviewer-bin=/usr/bin/overviewer.py
350+
mscs-overviewer-url=http://overviewer.org
351+
mscs-maps-location=/opt/mscs/maps
352+
mscs-maps-url=http://minecraft.server.com/maps
353+
261354
### Adjusting world properties
262-
The `mscs.properties` file can be found in every world folder
263-
(for instance, if you had a world called `myWorld`, the path would be
264-
`/opt/mscs/worlds/myWorld/mscs.properties`).
265-
This file allows you to adjust many different properties for each world
266-
you have. By default, the file only has one line in it: `mscs-enabled=true`.
355+
Each world server can override the default values in a similar manner by
356+
adding certain properties to the world's `mscs.properties` file. The
357+
`mscs.properties` file can be found in every world folder (for instance, if
358+
you had a world called `myWorld`, the path would be
359+
`/opt/mscs/worlds/myWorld/mscs.properties`). This file allows you to adjust
360+
many different properties for each world you have. By default, the file only
361+
has one line in it: `mscs-enabled=true`.
267362

268363
The following properties are available:
269364
* mscs-enabled - Enable the world server (true or false).
@@ -316,26 +411,6 @@ liking.
316411
Please visit the [wiki](https://github.com/MinecraftServerControl/mscs/wiki/Server-Customization-Examples)
317412
for additional information.
318413

319-
### Adjusting global server settings
320-
In tandem with the `mscs.properties` file--which handles options for
321-
individual worlds--is the `mscs` file, which handles global server settings.
322-
This file, like the `mscs.properties` file, has default settings already
323-
built-in to MSCS. However, you can also customize it to your liking:
324-
325-
**To customize the properties, you must create this file.** To create this
326-
file:
327-
328-
touch /etc/default/mscs
329-
330-
Once you've created the file, you need to populate it with a list of
331-
properties. The list of properties can be found [here](https://github.com/MinecraftServerControl/mscs/wiki/Global-Server-Settings).
332-
333-
### Configuring MSCS for multiple users
334-
MSCS has the capability to store server data for individual users, ideal for
335-
those who have multiple users on a computer and want each user's data to be
336-
separated. Please see the [wiki page](https://github.com/MinecraftServerControl/mscs/wiki/Configuring-MSCS-for-multiple-users)
337-
for instructions.
338-
339414
## Scheduling backups and other tasks
340415
All MSCS tasks can be automated using [**cron**]
341416
(https://en.wikipedia.org/wiki/Cron), a scheduler software that can run
@@ -374,9 +449,9 @@ for more information.
374449
The backups will be saved in `/opt/mscs/backups`.
375450

376451
### Removing backups after X days
377-
You can specify how long to keep backups by changing the `BACKUP_DURATION`
378-
in the `mscs.conf` or `mscs` file (see
379-
[adjusting global server settings](#adjusting-global-server-settings)
452+
You can specify how long to keep backups by changing the
453+
`mscs-backup-duration` property in the `mscs.defaults` file (see
454+
[adjusting global server properties](#adjusting-global-server-properties)
380455
).
381456

382457
### Scheduling restarts
@@ -402,13 +477,13 @@ worlds).
402477
Minecraft Server Control Script uses [Overviewer]
403478
(http://docs.overviewer.org/en/latest/) to generate maps. After [installing]
404479
(#mapping-software), modify the settings (if necessary) found in the
405-
`mscs.conf` or `mscs` file (see [adjusting global server settings]
406-
(#adjusting-global-server-settings)):
480+
`mscs.defaults` file (see [adjusting global server properties]
481+
(#adjusting-global-server-properties)):
407482

408-
OVERVIEWER_BIN=$(which overviewer.py)
409-
OVERVIEWER_URL="http://overviewer.org"
410-
MAPS_URL="my.minecraftserver.com"
411-
MAPS_LOCATION="$LOCATION/maps"
483+
mscs-overviewer-bin=/usr/bin/overviewer.py
484+
mscs-overviewer-url=http://overviewer.org
485+
mscs-maps-location=/opt/mscs/maps
486+
mscs-maps-url=my.minecraftserver.com
412487

413488

414489
After you've tinkered the settings to your liking, run:

mscs

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,17 @@
1515
# Get executable name
1616
PROG=$(basename $0)
1717

18-
# Load the mscs default file if it exists.
19-
MSCS_DEFAULTS="/etc/default/mscs"
20-
if [ -r $MSCS_DEFAULTS ]; then
21-
. $MSCS_DEFAULTS
22-
MSCS_ARGS="-c $MSCS_DEFAULTS "
23-
fi
24-
2518
# Setup the default user name.
26-
USER_NAME=${USER_NAME:-minecraft}
19+
USER_NAME="minecraft"
2720

2821
# Setup the default installation location.
29-
LOCATION=${LOCATION:-"/opt/mscs"}
22+
LOCATION="/opt/mscs"
23+
24+
# Setup the default location of the mscs.defaults file.
25+
MSCS_DEFAULTS="$LOCATION/mscs.defaults"
3026

3127
# Setup the arguments to the msctl script.
32-
MSCS_ARGS="-p $PROG -l $LOCATION $MSCS_ARGS $@"
28+
MSCS_ARGS="-p $PROG -l $LOCATION -c $MSCS_DEFAULTS $@"
3329

3430
# Run the msctl script.
3531
if [ "$USER_NAME" = "$(whoami)" ]; then

0 commit comments

Comments
 (0)