From cdeb526da45337be32fb6e8d80b8bfd4fe6a0f5e Mon Sep 17 00:00:00 2001 From: Ryan Wild Date: Sun, 21 Mar 2021 14:15:59 +0000 Subject: [PATCH] Re-worked the stop script to make it a bit better to work with Made sure it will now return a value if the server has been shut down as part of this script. Some minor improvements to it's efficiency in the process. --- FreeOP Servers/stop.sh | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/FreeOP Servers/stop.sh b/FreeOP Servers/stop.sh index 0ccc4a1..3c22887 100644 --- a/FreeOP Servers/stop.sh +++ b/FreeOP Servers/stop.sh @@ -1,24 +1,21 @@ #! -if screen -list | grep -q "TotalFreedom"; -then +if screen -list | grep -q "TotalFreedom"; then screen -X -S "TotalFreedom" stuff "stop^M" sleep 5 + if screen -list | grep -q "TotalFreedom"; then + screen -X -S "TotalFreedom" stuff "^C" + sleep 5 + fi + + if screen -list | grep -q "TotalFreedom"; then + screen -X -S "TotalFreedom" stuff "^C^C^C^C^C^C^C^C" + fi + + if screen -list | grep -q "TotalFreedom"; then + echo "Graceful Shutdown Failed. Please run tf!kill" + else + echo "Server has been shut down succesfully." + fi else echo "The server is not running... Try starting it <3" fi - -if screen -list | grep -q "TotalFreedom"; -then - screen -X -S "TotalFreedom" stuff "^C" - sleep 5 -fi - -if screen -list | grep -q "TotalFreedom"; -then - screen -X -S "TotalFreedom" stuff "^C^C^C^C^C^C^C^C" -fi - -if screen -list | grep -q "TotalFreedom"; -then - echo "Graceful Shutdown Failed. Please run tf!kill" -fi \ No newline at end of file