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.
This commit is contained in:
Ryan Wild 2021-03-21 14:15:59 +00:00
parent 4e71b18351
commit cdeb526da4
No known key found for this signature in database
GPG key ID: C224F5A8431F3F5C

View file

@ -1,24 +1,21 @@
#! #!
if screen -list | grep -q "TotalFreedom"; if screen -list | grep -q "TotalFreedom"; then
then
screen -X -S "TotalFreedom" stuff "stop^M" screen -X -S "TotalFreedom" stuff "stop^M"
sleep 5 sleep 5
else if screen -list | grep -q "TotalFreedom"; then
echo "The server is not running... Try starting it <3"
fi
if screen -list | grep -q "TotalFreedom";
then
screen -X -S "TotalFreedom" stuff "^C" screen -X -S "TotalFreedom" stuff "^C"
sleep 5 sleep 5
fi fi
if screen -list | grep -q "TotalFreedom"; if screen -list | grep -q "TotalFreedom"; then
then
screen -X -S "TotalFreedom" stuff "^C^C^C^C^C^C^C^C" screen -X -S "TotalFreedom" stuff "^C^C^C^C^C^C^C^C"
fi fi
if screen -list | grep -q "TotalFreedom"; if screen -list | grep -q "TotalFreedom"; then
then
echo "Graceful Shutdown Failed. Please run tf!kill" 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 fi