Refactored setting registration. Allows for default values. Added msm config command.

Settings are now registered using the register_setting and
register_server_setting functions. Settings registered via the first
function can be overridden in /etc/msm.conf, and settings registered
via the second function may also be overridden in server.properties.

Additionally, global variables are now better protected from confusion
with stronger namespacing.

Several settings have changed there names, these can be seen in the
diff for `msm.conf`. The same name changes also take effect in all
`server.properties files.

`msm <server> config` now displays a list of all setting when arguments
are omitted.

`msm config` is a new command which lists all setting values.
This commit is contained in:
Marcus Whybrow 2012-07-13 19:56:57 +01:00
parent b4f42d01e9
commit 1b874838cf
3 changed files with 375 additions and 379 deletions

View File

@ -74,7 +74,7 @@ _msm() {
if [ -d "$SERVER_STORAGE_PATH" ]; then if [ -d "$SERVER_STORAGE_PATH" ]; then
local servers="$(ls -1 "$SERVER_STORAGE_PATH")" local servers="$(ls -1 "$SERVER_STORAGE_PATH")"
fi fi
options="help start stop restart version server jargroup all $servers" options="help start stop restart version server jargroup all config $servers"
else else
case "${COMP_WORDS[1]}" in case "${COMP_WORDS[1]}" in
stop|restart) stop|restart)

715
init/msm

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,4 @@
#!/bin/bash #
# Minecraft Server Manager Configuration File # Minecraft Server Manager Configuration File
# =========================================== # ===========================================
# #
@ -64,6 +63,10 @@ BACKUP_ARCHIVE_PATH="/opt/msm/archives/backups"
# They are also the default values used when a new server is created, without # They are also the default values used when a new server is created, without
# specifying any arguments. # specifying any arguments.
# Any settings in the Server Defaults sections ending in PATH are relative
# to the server directory. That is unless an absolute path is given (one
# starting with a forward slash '/'.)
# User which stars the server, and interacts with it # User which stars the server, and interacts with it
DEFAULT_SERVER_USER="minecraft" DEFAULT_SERVER_USER="minecraft"
@ -90,15 +93,15 @@ DEFAULT_COMPLETE_BACKUP_FOLLOW_SYMLINKS="false"
# The location of standard Minecraft server files, relative to the # The location of standard Minecraft server files, relative to the
# server directory # server directory
DEFAULT_LOG="server.log" DEFAULT_LOG_PATH="server.log"
DEFAULT_PROPERTIES="server.properties" DEFAULT_PROPERTIES_PATH="server.properties"
DEFAULT_WHITELIST="white-list.txt" DEFAULT_WHITELIST_PATH="white-list.txt"
DEFAULT_BANNED_PLAYERS="banned-players.txt" DEFAULT_BANNED_PLAYERS_PATH="banned-players.txt"
DEFAULT_BANNED_IPS="banned-ips.txt" DEFAULT_BANNED_IPS_PATH="banned-ips.txt"
DEFAULT_OPS="ops.txt" DEFAULT_OPS_PATH="ops.txt"
# The location of the jar file to execute, relative to the server directory # The location of the jar file to execute, relative to the server directory
DEFAULT_JAR="server.jar" DEFAULT_JAR_PATH="server.jar"
# The amount of memory to dedicate to a server (in MB) # The amount of memory to dedicate to a server (in MB)
DEFAULT_RAM="1024" DEFAULT_RAM="1024"
@ -126,36 +129,36 @@ DEFAULT_RESTART_DELAY=10
# The default message to send to players on a server which is about to be # The default message to send to players on a server which is about to be
# shut down. You may use the tag "{DELAY}" to specify the time delay # shut down. You may use the tag "{DELAY}" to specify the time delay
# before shutdown: # before shutdown:
DEFAULT_STOP_MESSAGE="SERVER SHUTTING DOWN IN {DELAY} SECONDS!" DEFAULT_MESSAGE_STOP="SERVER SHUTTING DOWN IN {DELAY} SECONDS!"
# The default message sent to players on a server which was in the process of # The default message sent to players on a server which was in the process of
# shutting down, but was aborted by an admin probably pressing Ctrl+C. # shutting down, but was aborted by an admin probably pressing Ctrl+C.
DEFAULT_STOP_ABORT="Server shut down aborted." DEFAULT_MESSAGE_STOP_ABORT="Server shut down aborted."
# The default message sent to players on a server which is about to be # The default message sent to players on a server which is about to be
# restarted. You may use the tag "{DELAY}" to specify the time delay before # restarted. You may use the tag "{DELAY}" to specify the time delay before
# the server restarts: # the server restarts:
DEFAULT_RESTART_MESSAGE="SERVER REBOOT IN {DELAY} SECONDS!" DEFAULT_MESSAGE_RESTART="SERVER REBOOT IN {DELAY} SECONDS!"
# The default message sent to players on a server which was in the process of # The default message sent to players on a server which was in the process of
# restarting, but was aborted by an admin probably pressing Ctrl+C. # restarting, but was aborted by an admin probably pressing Ctrl+C.
DEFAULT_RESTART_ABORT="Server reboot aborted." DEFAULT_MESSAGE_RESTART_ABORT="Server reboot aborted."
# The default message to send to players when a server begins backing up # The default message to send to players when a server begins backing up
# its worlds: # its worlds:
DEFAULT_WORLD_BACKUP_STARTED="Backing up world." DEFAULT_MESSAGE_WORLD_BACKUP_STARTED="Backing up world."
# The default message to send to players when a server has finished backing # The default message to send to players when a server has finished backing
# up its worlds: # up its worlds:
DEFAULT_WORLD_BACKUP_FINISHED="Backup complete." DEFAULT_MESSAGE_WORLD_BACKUP_FINISHED="Backup complete."
# The default message to send to players when a server begins backing up the # The default message to send to players when a server begins backing up the
# entire server directory: # entire server directory:
DEFAULT_COMPLETE_BACKUP_STARTED="Backing up entire server." DEFAULT_MESSAGE_COMPLETE_BACKUP_STARTED="Backing up entire server."
# The default message to send to players when a serer finishes backing up the # The default message to send to players when a serer finishes backing up the
# entire server directory: # entire server directory:
DEFAULT_COMPLETE_BACKUP_FINISHED="Backup complete." DEFAULT_MESSAGE_COMPLETE_BACKUP_FINISHED="Backup complete."
# The message once logged confirms the "save-on" command has finished # The message once logged confirms the "save-on" command has finished