From 769db18f3547095be3616be73634ee611fdc802a Mon Sep 17 00:00:00 2001 From: Price Hiller Date: Sat, 31 Jul 2021 19:19:54 -0500 Subject: [PATCH] Added two scripts: Connect & Stop to Minecraft --- .../Minecraft/Minecraft-Connect-Server.bash | 17 ++++++++++++++++ CentOS/Minecraft/Minecraft-Stop-Server.bash | 20 +++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100755 CentOS/Minecraft/Minecraft-Connect-Server.bash create mode 100755 CentOS/Minecraft/Minecraft-Stop-Server.bash diff --git a/CentOS/Minecraft/Minecraft-Connect-Server.bash b/CentOS/Minecraft/Minecraft-Connect-Server.bash new file mode 100755 index 0000000..050bcac --- /dev/null +++ b/CentOS/Minecraft/Minecraft-Connect-Server.bash @@ -0,0 +1,17 @@ +#!/bin/bash --posix + +set -e + +usage() { + echo \ + "Help Menu + Usage: $(basename ${0}) " + exit "${1}" +} + +[[ -z "${1}" ]] && usage 1 +[[ "${1}" == "--help" || "${1}" == "-h" ]] && usage 0 + +tmux attach-session -t "Minecraft-Server-${1}" + +exit ${?} diff --git a/CentOS/Minecraft/Minecraft-Stop-Server.bash b/CentOS/Minecraft/Minecraft-Stop-Server.bash new file mode 100755 index 0000000..b5a41fb --- /dev/null +++ b/CentOS/Minecraft/Minecraft-Stop-Server.bash @@ -0,0 +1,20 @@ +#!/bin/bash + +set -e + +usage() { + echo \ +"Help Menu + Usage: $(basename "${0}") " + exit "${1}" +} + + +[[ -z "${1}" ]] && usage 1 +[[ "${1}" == "--help" || "${1}" == "-h" ]] && usage 0 + +tmux send-keys -t "Minecraft-Server-${1}" "C-c" ENTER > /dev/null 2>&1 \ + && echo "Stopped Minecraft-Server-${1}" \ + || echo "Could not find Minecraft-Server-${1}" + +exit ${?} \ No newline at end of file