summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorBuildTools2016-01-31 21:58:41 -0800
committerBuildTools2016-01-31 21:58:41 -0800
commit0a9edcc7b234798b5496eae36a6a2f5364a3cf8c (patch)
tree44cec62cd79bfc6b7f9dec3e08fee607f8e74c62
parent242523469d89c1b6a075728ec8526656fd742d41 (diff)
downloadaur-0a9edcc7b234798b5496eae36a6a2f5364a3cf8c.tar.gz
Merge script changes from edn
-rw-r--r--.SRCINFO10
-rwxr-xr-xPKGBUILD8
-rw-r--r--spigot-backup.timer1
-rw-r--r--spigot.conf5
-rwxr-xr-xspigot.install33
-rwxr-xr-xspigot.sh350
6 files changed, 250 insertions, 157 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 568aefb7f09..411f6486aaa 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,7 +1,9 @@
+# Generated by mksrcinfo v8
+# Mon Feb 1 05:57:19 UTC 2016
pkgbase = spigot
pkgdesc = High performance Minecraft server implementation
pkgver = 1.8.8
- pkgrel = 5
+ pkgrel = 6
url = http://www.spigotmc.org/
install = spigot.install
arch = any
@@ -30,10 +32,10 @@ pkgbase = spigot
source = spigot.sh
md5sums = SKIP
md5sums = fd17202ba0bb7796439f0b2f6bc53be4
- md5sums = 774cd44ed90f6be51d368533cf74d7c2
+ md5sums = 872d2e03799f1f8f0c75acdebce91894
md5sums = 580c470c92d88ae2362250d59bd33b10
- md5sums = 12a49f9b4ba6e5f4887555af0947949b
- md5sums = 528b26d2326fe92d96d29d8b615c9d6d
+ md5sums = 675f4b1080f2543f43058c7124dcafc2
+ md5sums = 38c9c94d10e2f6ca86a56cdb0d47d72a
pkgname = spigot
diff --git a/PKGBUILD b/PKGBUILD
index 9731276a3ce..c6e56c3825e 100755
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,7 +1,7 @@
# Maintainer: Gordian Edenhofer <gordian.edenhofer[at]yahoo[dot]de>
pkgname=spigot
pkgver=1.8.8
-pkgrel=5
+pkgrel=6
pkgdesc="High performance Minecraft server implementation"
arch=(any)
url="http://www.spigotmc.org/"
@@ -21,10 +21,10 @@ source=("https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/art
noextract=("BuildTools.jar")
md5sums=('SKIP'
'fd17202ba0bb7796439f0b2f6bc53be4'
- '774cd44ed90f6be51d368533cf74d7c2'
+ '872d2e03799f1f8f0c75acdebce91894'
'580c470c92d88ae2362250d59bd33b10'
- '12a49f9b4ba6e5f4887555af0947949b'
- '528b26d2326fe92d96d29d8b615c9d6d')
+ '675f4b1080f2543f43058c7124dcafc2'
+ '38c9c94d10e2f6ca86a56cdb0d47d72a')
backup=("etc/conf.d/${pkgname}")
build() {
diff --git a/spigot-backup.timer b/spigot-backup.timer
index ba2911de9a2..be4b690d86b 100644
--- a/spigot-backup.timer
+++ b/spigot-backup.timer
@@ -2,7 +2,6 @@
Description=Daily Spigot Backup
[Timer]
-Type=forking
OnCalendar=daily
AccuracySec=5min
Persistent=true
diff --git a/spigot.conf b/spigot.conf
index 3796f3324f2..7d2fe630371 100644
--- a/spigot.conf
+++ b/spigot.conf
@@ -1,10 +1,11 @@
-# THIS IS THE CONFIGURATION FILE FOR THE SCRIPT NOT FOR THE ACTUAL SERVER
+# THIS IS THE CONFIGURATION FILE FOR THE MANAGING SCRIPT NOT FOR THE ACTUAL SERVER
+# Variables are interpreted in bash. Simply using bash-syntax is sufficient.
# General parameters
SERVER_ROOT="/srv/craftbukkit"
BACKUPPATH="/srv/craftbukkit/backup"
LOGPATH="/srv/craftbukkit/logs"
-WORLDPATHS="/srv/craftbukkit/world /srv/craftbukkit/world_nether /srv/craftbukkit/world_the_end"
+WORLDPATHS="world world_nether world_the_end" # World paths separated by spaces relative to SERVER_ROOT
KEEP_BACKUPS="10"
MC_USER="craftbukkit"
MAIN_JAR="spigot.jar"
diff --git a/spigot.install b/spigot.install
index ea9aaf50127..9422066f97b 100755
--- a/spigot.install
+++ b/spigot.install
@@ -1,41 +1,44 @@
USER="craftbukkit"
SERVER_ROOT="/srv/craftbukkit"
-_update() {
+post_install() {
getent group "${USER}" &>/dev/null
- if [ $? -ne 0 ]; then
- echo -e "\e[34;1m==>\e[39;1m Adding ${USER} system group... \e[0m"
+ if [ $? -ne 0 ]; then
+ echo -e "\e[34;1m==>\e[39;1m Adding ${USER} system group... \e[0m"
groupadd -r ${USER} 1>/dev/null
fi
getent passwd "${USER}" &>/dev/null
if [ $? -ne 0 ]; then
- echo -e "\e[34;1m==>\e[39;1m Adding ${USER} system user... \e[0m"
+ echo -e "\e[34;1m==>\e[39;1m Adding ${USER} system user... \e[0m"
useradd -r -g ${USER} -d "${SERVER_ROOT}" ${USER} 1>/dev/null
fi
- chown -R ${USER}:${USER} "${SERVER_ROOT}"
+ chown -R ${USER}:${USER} "${SERVER_ROOT}"
echo -e "\e[34;1m==>\e[39;1m NOTE: The world data is stored under ${SERVER_ROOT} and the server runs \e[0m"
- echo -e "\e[34;1m==>\e[39;1m as ${USER} user to increase security. \e[0m"
- echo -e "\e[34;1m==>\e[39;1m NOTE: Use the spigot script under /usr/bin/spigot to start, stop or backup the server \e[0m"
+ echo -e "\e[34;1m==>\e[39;1m as ${USER} user to increase security. \e[0m"
+ echo -e "\e[34;1m==>\e[39;1m NOTE: Use the spigot script under /usr/bin/spigot to start, stop or backup the server \e[0m"
echo -e "\e[34;1m==>\e[39;1m and the configuration file under /etc/conf.d/spigot to adjust it to your liking. \e[0m"
echo -e "\e[34;1m==>\e[39;1m NOTE: For the server to start you have to accept the EULA in ${SERVER_ROOT}/eula.txt \e[0m"
echo -e "\e[34;1m==>\e[39;1m which is generated after the first server start. \e[0m"
}
-post_install() {
- _update
-}
-
post_upgrade() {
- _update
+ chown -R ${USER}:${USER} "${SERVER_ROOT}"
+
+ if [[ -f /etc/conf.d/minecraft.pacnew ]]; then
+ echo -e "\e[34;1m==>\e[39;1m NOTE: There was a new change on how backup files are handled! Unfortunately this makes \e[0m"
+ echo -e "\e[34;1m==>\e[39;1m old backups incompatible with the newly implemeted restore feature. Bare in mind that no data is lost \e[0m"
+ echo -e "\e[34;1m==>\e[39;1m neither are those backups useless. They just will not work with the restore capability of the management script. \e[0m"
+ echo -e "\e[34;1m==>\e[39;1m NOTE: Please merge the new configuration file into /etc/conf.d/minecraft by e.g. using pacdiff. \e[0m"
+ fi
}
pre_remove() {
echo -e "\e[34;1m==>\e[39;1m Stopping and disabling spigot daemon... \e[0m"
systemctl stop spigot.service
- systemctl disable spigot.service
+ systemctl disable spigot.service
/usr/bin/spigot stop > /dev/null
}
@@ -50,6 +53,6 @@ post_remove() {
fi
# Notifying the user of kept dirs
- [ -d ${SERVER_ROOT} ] && chown root:root ${SERVER_ROOT} && echo -e "\e[34;1m==>\e[39;1m NOTE: Game saves in ${SERVER_ROOT} were kept on your system.\e[0m"
- [ -d /etc/conf.d/spigot ] && echo -e "\e[34;1m==>\e[39;1m NOTE: Your configuration file /etc/conf.d/spigot was kept on your system.\e[0m"
+ [[ -d "${SERVER_ROOT}" ]] && chown -R root:root "${SERVER_ROOT}" && echo -e "\e[34;1m==>\e[39;1m NOTE: Game saves in ${SERVER_ROOT} were kept on your system.\e[0m"
+ [[ -f "/etc/conf.d/spigot" ]] && echo -e "\e[34;1m==>\e[39;1m NOTE: Your configuration file /etc/conf.d/spigot was kept on your system.\e[0m"
}
diff --git a/spigot.sh b/spigot.sh
index 2907ac563be..6ab0158a885 100755
--- a/spigot.sh
+++ b/spigot.sh
@@ -2,11 +2,14 @@
source /etc/conf.d/spigot || echo "Could not source /etc/conf.d/spigot"
+# General rule variable naming schema:
+# Variables in capital letters may be passed through the command line others not.
+
# You may use this script for any minecraft server of your choice, just alter the config file
SERVER_ROOT="${SERVER_ROOT:-/srv/craftbukkit}"
BACKUPPATH="${BACKUPPATH:-/srv/craftbukkit/backup}"
LOGPATH="${LOGPATH:-/srv/craftbukkit/logs}"
-WORLDPATHS="${WORLDPATHS:-/srv/craftbukkit/world /srv/craftbukkit/world_nether /srv/craftbukkit/world_the_end}"
+WORLDPATHS="${WORLDPATHS:-world world_nether world_the_end}"
KEEP_BACKUPS="${KEEP_BACKUPS:-10}"
MC_USER="${MC_USER:-craftbukkit}"
MAIN_JAR="${MAIN_JAR:-spigot.jar}"
@@ -18,188 +21,273 @@ MAXHEAP="${MAXHEAP:-1024M}"
THREADS="${THREADS:-1}"
JAVA_PARMS="${JAVA_PARMS:-"-Xmx${MAXHEAP} -Xms${MINHEAP} -XX:ParallelGCThreads=${THREADS}"}"
+# The actual program name
+declare -r myname="spigot"
+
+# Check whether sudo is needed at all
+if [[ $(whoami) == ${MC_USER} ]]; then
+ SUDO_CMD=""
+else
+ SUDO_CMD="sudo -u ${MC_USER}"
+fi
+
# Check for sudo rigths
-if [ $(sudo whoami) != "root" ]; then
- echo "You must have sudo access in order to use this script."
- exit 1
+if [[ $(${SUDO_CMD} whoami) != ${MC_USER} ]]; then
+ echo -e "You have \e[39;1mno permission\e[0m to run commands as $MC_USER user."
+ exit 1
fi
# Pipe any given argument to the minecraft server console
mc_command() {
- sudo -u ${MC_USER} screen -S ${SESSION_NAME} -X stuff "`printf \"$*\r\"`"
+ ${SUDO_CMD} screen -S "${SESSION_NAME}" -X stuff "`printf \"$*\r\"`"
}
# Start the server if it is not already running
server_start() {
- sudo -u ${MC_USER} screen -S ${SESSION_NAME} -Q select . > /dev/null
- if [ $? -eq 0 ]; then
- echo "A screen ${SESSION_NAME} session is already running. Please close it first."
- else
- echo -en "Starting server... "
- sudo -u ${MC_USER} screen -dmS ${SESSION_NAME} /bin/bash -c "cd ${SERVER_ROOT}; java ${JAVA_PARMS} -jar ${SERVER_ROOT}/${MAIN_JAR} nogui"
- echo -e "\e[39;1m done\e[0m"
- fi
+ ${SUDO_CMD} screen -S "${SESSION_NAME}" -Q select . > /dev/null
+ if [[ $? -eq 0 ]]; then
+ echo "A screen ${SESSION_NAME} session is already running. Please close it first."
+ else
+ echo -en "Starting server... "
+ ${SUDO_CMD} screen -dmS "${SESSION_NAME}" /bin/bash -c "cd '${SERVER_ROOT}'; java ${JAVA_PARMS} -jar '${SERVER_ROOT}/${MAIN_JAR}' nogui"
+ echo -e "\e[39;1m done\e[0m"
+ fi
}
# Stop the server gracefully by saving everything prior and warning the users
server_stop() {
- sudo -u ${MC_USER} screen -S ${SESSION_NAME} -Q select . > /dev/null
- if [ $? -eq 0 ]; then
- mc_command save-all
- mc_command say "Server is going down in 10 seconds! HURRY UP WITH WATHEVER YOU ARE DOING!" # Warning the users
- echo -en "Server is going down in... "
- for i in $(seq 1 10);
- do
- mc_command say "down in... $(expr 10 - $i)"
- echo -n " $(expr 10 - $i)"
- sleep 1
- done
- mc_command stop
- echo -e "\e[39;1m done\e[0m"
- else
- echo "The corresponding screen session for ${SESSION_NAME} was already dead."
- fi
+ ${SUDO_CMD} screen -S "${SESSION_NAME}" -Q select . > /dev/null
+ if [[ $? -eq 0 ]]; then
+ mc_command save-all
+ mc_command say "Server is going down in 10 seconds! HURRY UP WITH WATHEVER YOU ARE DOING!" # Warning the users
+ echo -en "Server is going down in... "
+ for i in $(seq 1 10); do
+ mc_command say "down in... $(expr 10 - $i)"
+ echo -n " $(expr 10 - $i)"
+ sleep 1
+ done
+ mc_command stop
+ echo -e "\e[39;1m done\e[0m"
+ else
+ echo "The corresponding screen session for ${SESSION_NAME} was already dead."
+ fi
}
# Print whether the server is running and if so give some information about memory usage and threads
server_status() {
- sudo -u ${MC_USER} screen -S ${SESSION_NAME} -Q select . > /dev/null
- if [ $? -eq 0 ]; then
- echo -e "Status:\e[39;1m running\e[0m"
-
- # Calculating memory usage
- for p in $(sudo -u ${MC_USER} pgrep -f ${MAIN_JAR}); do
- ps -p$p -O rss | tail -n1;
- done | gawk '{ count ++; sum += $2 }; END {count --; print "Number of processes =", count, "(screen, bash,", count-2, "x java)"; print "Total memory usage =", sum/1024, "MB" ;};'
- else
- echo -e "Status:\e[39;1m stopped\e[0m"
- fi
+ ${SUDO_CMD} screen -S "${SESSION_NAME}" -Q select . > /dev/null
+ if [[ $? -eq 0 ]]; then
+ echo -e "Status:\e[39;1m running\e[0m"
+
+ # Calculating memory usage
+ for p in $(${SUDO_CMD} pgrep -f "${MAIN_JAR}"); do
+ ps -p${p} -O rss | tail -n1;
+ done | gawk '{ count ++; sum += $2 }; END {count --; print "Number of processes =", count, "(screen, bash,", count-2, "x java)"; print "Total memory usage =", sum/1024, "MB" ;};'
+ else
+ echo -e "Status:\e[39;1m stopped\e[0m"
+ fi
}
# Restart the complete server by shutting it down and starting it again
server_restart() {
- sudo -u ${MC_USER} screen -S ${SESSION_NAME} -Q select . > /dev/null
- if [ $? -eq 0 ]; then
- server_stop
- sleep 0.1
- server_start
- else
- server_start
- fi
+ ${SUDO_CMD} screen -S "${SESSION_NAME}" -Q select . > /dev/null
+ if [[ $? -eq 0 ]]; then
+ server_stop
+ sleep 0.1
+ server_start
+ else
+ server_start
+ fi
}
# Backup the directories specified in $WORLDPATHS
backup_files() {
- which tar &> /dev/null
- if [ $? -ne 0 ]; then
- echo "The tar binaries are needed for a backup."
- exit 2
- fi
-
- echo "Starting backup..."
- FILE="`date +%Y%m%d%H%M%S`.tar.gz"
- sudo -u ${MC_USER} mkdir -p ${BACKUPPATH}
- sudo -u ${MC_USER} screen -S ${SESSION_NAME} -Q select . > /dev/null
- if [ $? -eq 0 ]; then
- mc_command save-off
- mc_command save-all
- sync && wait
- sudo -u ${MC_USER} tar -czf ${BACKUPPATH}/${FILE} --totals ${WORLDPATHS} 2>&1 | grep -v "tar: Removing leading "
- mc_command save-on
- else
- sudo -u ${MC_USER} tar -czf ${BACKUPPATH}/${FILE} --totals ${WORLDPATHS} 2>&1 | grep -v "tar: Removing leading "
- fi
- echo -e "\e[39;1mbackup completed\e[0m\n"
-
- echo -n "Only keeping the last ${KEEP_BACKUPS} backups and removing the other ones..."
- BACKUP_COUNT=$(for f in ${BACKUPPATH}/[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]*; do echo $f; done | wc -l)
- if [ $(expr ${BACKUP_COUNT} - ${KEEP_BACKUPS}) -gt 0 ]; then
- sudo -u ${MC_USER} rm $(for f in ${BACKUPPATH}/[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]*; do echo $f; done | head -n$(expr ${BACKUP_COUNT} - ${KEEP_BACKUPS}))
- echo -e "\e[39;1m done\e[0m ($(expr ${BACKUP_COUNT} - ${KEEP_BACKUPS}) backup(s) pruned)"
- else
- echo -e "\e[39;1m done\e[0m (no backups pruned)"
- fi
+ # Check for the availability of the tar binaries
+ which tar &> /dev/null
+ if [[ $? -ne 0 ]]; then
+ echo "The tar binaries are needed for a backup."
+ exit 2
+ fi
+
+ echo "Starting backup..."
+ FILE="$(date +%Y_%m_%d_%H.%M.%S).tar.gz"
+ ${SUDO_CMD} mkdir -p "${BACKUPPATH}"
+ ${SUDO_CMD} screen -S "${SESSION_NAME}" -Q select . > /dev/null
+ if [[ $? -eq 0 ]]; then
+ mc_command save-off
+ mc_command save-all
+ sync && wait
+ ${SUDO_CMD} tar -C "${SERVER_ROOT}" -czf "${BACKUPPATH}/${FILE}" --totals "${WORLDPATHS}" 2>&1 | grep -v "tar: Removing leading "
+ mc_command save-on
+ else
+ ${SUDO_CMD} tar -C "${SERVER_ROOT}" -czf "${BACKUPPATH}/${FILE}" --totals "${WORLDPATHS}" 2>&1 | grep -v "tar: Removing leading "
+ fi
+ echo -e "\e[39;1mbackup completed\e[0m\n"
+
+ echo -n "Only keeping the last ${KEEP_BACKUPS} backups and removing the other ones..."
+ BACKUP_COUNT=$(for f in "${BACKUPPATH}"/[0-9_.]*; do echo ${f}; done | wc -l)
+ if [[ $(expr ${BACKUP_COUNT} - ${KEEP_BACKUPS}) -gt 0 ]]; then
+ ${SUDO_CMD} rm $(for f in "${BACKUPPATH}"/[0-9_.]*; do echo ${f}; done | head -n$(expr ${BACKUP_COUNT} - ${KEEP_BACKUPS}))
+ echo -e "\e[39;1m done\e[0m ($(expr ${BACKUP_COUNT} - ${KEEP_BACKUPS}) backup(s) pruned)"
+ else
+ echo -e "\e[39;1m done\e[0m (no backups pruned)"
+ fi
+}
+
+# Restore backup
+backup_restore() {
+ # Check for the availability of the tar binaries
+ which tar &> /dev/null
+ if [[ $? -ne 0 ]]; then
+ echo "The tar binaries are needed for a backup."
+ exit 2
+ fi
+
+ # Only allow the user to restore a backup if the server is down
+ ${SUDO_CMD} screen -S "${SESSION_NAME}" -Q select . > /dev/null
+ if [[ $? -eq 0 ]]; then
+ echo -e "The \e[39;1mserver should be down\e[0m in order to restore the world data."
+ exit 3
+ fi
+
+ # Either let the user choose a backup or expect one as an argument
+ if [[ $# -lt 1 ]]; then
+ echo "Please enter the corresponding number for the backup to be restored: "
+ i=1
+ for f in "${BACKUPPATH}"/[0-9_.]*; do
+ echo -e " \e[39;1m$i)\e[0m\t$f"
+ i=$((i+1))
+ done
+ echo -en "Restore backup number: "
+
+ # Read in user input
+ read user_choice
+
+ # Interpeting the input
+ if [[ $user_choice =~ ^-?[0-9]+$ ]]; then
+ n=1
+ for f in "${BACKUPPATH}"/[0-9_.]*; do
+ [[ ${n} -eq $user_choice ]] && FILE="$f"
+ n=$((n+1))
+ done
+ if [[ -z $FILE ]]; then
+ echo -e "\e[39;1mFailed\e[0m to interpret your input. Please enter the digit of the presented options."
+ exit 5
+ fi
+ else
+ echo -e "\e[39;1mFailed\e[0m to interpret your input. Please enter a valid digit for one of the presented options."
+ exit 6
+ fi
+ elif [[ $# -eq 1 ]]; then
+ # Check for the existance of the specified file
+ if [[ -f "$1" ]]; then
+ FILE="$1"
+ else
+ if [[ -f "${BACKUPPATH}"/"$1" ]]; then
+ FILE="${BACKUPPATH}"/"$1"
+ else
+ echo -e "Sorry, but '$1', is \e[39;1mnot a valid file\e[0m, neither in your current directory nor in the backup folder."
+ exit 4
+ fi
+ fi
+ elif [[ $# -gt 1 ]]; then
+ echo -e "\e[39;1mToo many arguments.\e[0m Please pass only the filename for the world data as an argument."
+ echo "Or alternatively no arguments at all to chose from a list of available backups."
+ exit 1
+ fi
+
+ echo "Restoring backup..."
+ ${SUDO_CMD} tar -xf "${FILE}" -C "${SERVER_ROOT}" 2>&1
+ if [[ $? -eq 0 ]]; then
+ echo -e "\e[39;1mRestoration completed\e[0m"
+ else
+ echo -e "\e[39;1mFailed to restore backup.\e[0m"
+ fi
}
# Run the given comman at the minecraft server console
server_command() {
- if [ $# -lt 1 ]; then
- echo "No server command specified. Try 'help' for a list of commands."
- exit 1
- fi
-
- sudo -u ${MC_USER} screen -S ${SESSION_NAME} -Q select . > /dev/null
- if [ $? -eq 0 ]; then
- mc_command "$@"
- tailf -n 0 ${LOGPATH}/latest.log &
- TAILFPID=$! # Process id of tailf command
- sleep 0.1
- kill ${TAILFPID}
- else
- echo "There is no ${SESSION_NAME} session to connect to."
- fi
+ if [[ $# -lt 1 ]]; then
+ echo "No server command specified. Try 'help' for a list of commands."
+ exit 1
+ fi
+
+ ${SUDO_CMD} screen -S "${SESSION_NAME}" -Q select . > /dev/null
+ if [[ $? -eq 0 ]]; then
+ sleep 0.1s &
+ sleep_pid=$!
+ mc_command "$@" &
+ tail -f --pid=${sleep_pid} -n 0 "${LOGPATH}/latest.log"
+ else
+ echo "There is no ${SESSION_NAME} session to connect to."
+ fi
}
# Enter the screen minecraft session
server_console() {
- sudo -u ${MC_USER} screen -S ${SESSION_NAME} -Q select . > /dev/null
- if [ $? -eq 0 ]; then
- sudo -u ${MC_USER} screen -S ${SESSION_NAME} -rx
- else
- echo "There is no ${SESSION_NAME} session to connect to."
- fi
+ ${SUDO_CMD} screen -S "${SESSION_NAME}" -Q select . > /dev/null
+ if [[ $? -eq 0 ]]; then
+ ${SUDO_CMD} screen -S "${SESSION_NAME}" -rx
+ else
+ echo "There is no ${SESSION_NAME} session to connect to."
+ fi
}
# Help function, no arguments required
help() {
- cat << 'EOF'
-This script was design to easily control any minecraft server. Quite every parameter for a given
-minecraft server derivative can be altered by editing the variables in the configuration file.
-
-Usage: spigot {start|stop|status|backup|command <command>|console}
- start Start the minecraft server
- stop Stop the minecraft server
- restart Restart the minecraft server
- status Print some status information
- backup Backup the world data
- command <command> Run the given comman at the minecraft server console
- console Enter the server console through a screen session
-
-Copyright (c) Gordian Edenhofer <gordian.edenhofer@gmail.com>
-EOF
+ cat <<-EOF
+ This script was design to easily control any minecraft server. Quite every parameter for a given
+ minecraft server derivative can be altered by editing the variables in the configuration file.
+
+ Usage: $myname {start|stop|status|backup|restore|command <command>|console}
+ start Start the minecraft server
+ stop Stop the minecraft server
+ restart Restart the minecraft server
+ status Print some status information
+ backup Backup the world data
+ restore [filename] Restore the world data from a backup
+ command <command> Run the given comman at the minecraft server console
+ console Enter the server console through a screen session
+
+ Copyright (c) Gordian Edenhofer <gordian.edenhofer@gmail.com>
+ EOF
}
case "$1" in
start)
- server_start
- ;;
+ server_start
+ ;;
stop)
- server_stop
- ;;
+ server_stop
+ ;;
- status)
- server_status
- ;;
+ status)
+ server_status
+ ;;
- restart)
- server_restart
- ;;
+ restart)
+ server_restart
+ ;;
console)
- server_console
- ;;
+ server_console
+ ;;
- command)
- server_command "${@:2}"
- ;;
+ command)
+ server_command "${@:2}"
+ ;;
backup)
- backup_files
- ;;
+ backup_files
+ ;;
+
+ restore)
+ backup_restore "${@:2}"
+ ;;
*|-h|--help)
- help
+ help
esac
exit 0