From 266d5b0bf00242369037e7f5e73c4f4eaed3d4d3 Mon Sep 17 00:00:00 2001 From: peet Date: Sun, 2 Jan 2022 18:51:34 +0100 Subject: [PATCH] cleanup code with variables for better access --- bukkit-console | 12 +++++++----- bukkit-start | 8 +++++--- bukkit-status | 4 +++- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/bukkit-console b/bukkit-console index ce0e665..a234f65 100755 --- a/bukkit-console +++ b/bukkit-console @@ -4,6 +4,8 @@ # | bukkit-console by Elias Schriefer | # ×===================================× +server="" + if [ "$1" = "-h" ] then echo "bukkit-console [option]" @@ -18,27 +20,27 @@ fi # Get the bukkit server status: is it running or stopped? # We don't need echo, but thx anyways... -bukkit-status > /dev/null +$server-status > /dev/null if [ $? -gt 0 ] then # If the server is stopped, fukcing start it, man! - bukkit-start + $server-start fi if [ "$1" = "-f" ] then # Gimme the console - sudo screen -xr bukkit + sudo screen -xr $server # Now gimme my suxesvul eksid koud... true elif [ "$1" = "-ff" ] then # Hand me the console over - sudo screen -dr bukkit + sudo screen -dr $server # Now gimme my suxesvul eksid koud... true else # Gimme the console, plz... - sudo screen -rq bukkit + sudo screen -rq $server if [ $? -gt 0 ] then # If the console is attached elsewhere, say it diff --git a/bukkit-start b/bukkit-start index b189646..b6d3b2f 100755 --- a/bukkit-start +++ b/bukkit-start @@ -4,6 +4,8 @@ # | bukkit-start by Elias Schriefer | # ×=================================× +server="" + if [ "$1" = "-h" ] then echo "bukkit-start [option]" @@ -15,14 +17,14 @@ fi # Get the bukkit server status: is it running or stopped? # We don't need echo, but thx anyways... -bukkit-status > /dev/null +$server-status > /dev/null if [ $? -gt 0 ] then # 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" # 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... true else diff --git a/bukkit-status b/bukkit-status index 39cbd8f..57dac64 100755 --- a/bukkit-status +++ b/bukkit-status @@ -4,6 +4,8 @@ # | bukkit-status by Elias Schriefer | # ×==================================× +server="" + if [ "$1" = "-h" ] then echo "bukkit-status [option]" @@ -15,7 +17,7 @@ fi # Is there a window with name "bukkit" already running in screen? # We don't need your fukcing text, ew... -sudo screen -ls bukkit > /dev/null +sudo screen -ls $server > /dev/null if [ $? -eq 0 ] then # If the screen window is indeed running, shout it in my