cleanup code with variables for better access

This commit is contained in:
Johannes Schmelz 2022-01-02 18:51:34 +01:00
parent 71b1cc7924
commit 266d5b0bf0
3 changed files with 15 additions and 9 deletions

View File

@ -4,6 +4,8 @@
# | bukkit-console by Elias Schriefer | # | bukkit-console by Elias Schriefer |
# ×===================================× # ×===================================×
server=""
if [ "$1" = "-h" ] if [ "$1" = "-h" ]
then then
echo "bukkit-console [option]" echo "bukkit-console [option]"
@ -18,27 +20,27 @@ fi
# Get the bukkit server status: is it running or stopped? # Get the bukkit server status: is it running or stopped?
# We don't need echo, but thx anyways... # We don't need echo, but thx anyways...
bukkit-status > /dev/null $server-status > /dev/null
if [ $? -gt 0 ] if [ $? -gt 0 ]
then then
# If the server is stopped, fukcing start it, man! # If the server is stopped, fukcing start it, man!
bukkit-start $server-start
fi fi
if [ "$1" = "-f" ] if [ "$1" = "-f" ]
then then
# Gimme the console # Gimme the console
sudo screen -xr bukkit sudo screen -xr $server
# Now gimme my suxesvul eksid koud... # Now gimme my suxesvul eksid koud...
true true
elif [ "$1" = "-ff" ] elif [ "$1" = "-ff" ]
then then
# Hand me the console over # Hand me the console over
sudo screen -dr bukkit sudo screen -dr $server
# Now gimme my suxesvul eksid koud... # Now gimme my suxesvul eksid koud...
true true
else else
# Gimme the console, plz... # Gimme the console, plz...
sudo screen -rq bukkit sudo screen -rq $server
if [ $? -gt 0 ] if [ $? -gt 0 ]
then then
# If the console is attached elsewhere, say it # If the console is attached elsewhere, say it

View File

@ -4,6 +4,8 @@
# | bukkit-start by Elias Schriefer | # | bukkit-start by Elias Schriefer |
# ×=================================× # ×=================================×
server=""
if [ "$1" = "-h" ] if [ "$1" = "-h" ]
then then
echo "bukkit-start [option]" echo "bukkit-start [option]"
@ -15,14 +17,14 @@ fi
# Get the bukkit server status: is it running or stopped? # Get the bukkit server status: is it running or stopped?
# We don't need echo, but thx anyways... # We don't need echo, but thx anyways...
bukkit-status > /dev/null $server-status > /dev/null
if [ $? -gt 0 ] if [ $? -gt 0 ]
then then
# If the server is stopped, go into the server directory, ... # If the server is stopped, go into the server directory, ...
cd /media/games/bukkit/ cd /media/games/$server/
# start the screen with Socket name & title "bukkit" # start the screen with Socket name & title "bukkit"
# and run the start script # and run the start script
sudo screen -dmS bukkit -t bukkit ./Start.sh sudo screen -dmS $server -t $server ./start.sh
# Now gimme my suxesvul eksit koud... # Now gimme my suxesvul eksit koud...
true true
else else

View File

@ -4,6 +4,8 @@
# | bukkit-status by Elias Schriefer | # | bukkit-status by Elias Schriefer |
# ×==================================× # ×==================================×
server=""
if [ "$1" = "-h" ] if [ "$1" = "-h" ]
then then
echo "bukkit-status [option]" echo "bukkit-status [option]"
@ -15,7 +17,7 @@ fi
# Is there a window with name "bukkit" already running in screen? # Is there a window with name "bukkit" already running in screen?
# We don't need your fukcing text, ew... # We don't need your fukcing text, ew...
sudo screen -ls bukkit > /dev/null sudo screen -ls $server > /dev/null
if [ $? -eq 0 ] if [ $? -eq 0 ]
then then
# If the screen window is indeed running, shout it in my # If the screen window is indeed running, shout it in my