2021-03-21 14:04:57 +00:00
|
|
|
#!
|
2021-06-27 17:35:05 +00:00
|
|
|
|
|
|
|
#Pull in the .env file for variables.
|
|
|
|
source .env.sh
|
|
|
|
|
2021-06-27 19:36:52 +00:00
|
|
|
if test -f "$RESET_FILE";
|
|
|
|
then
|
|
|
|
echo "CRITICAL ERORR - Server is currently re-setting. Please wait for this action to complete."
|
|
|
|
exit 1
|
|
|
|
else
|
2021-06-27 17:35:05 +00:00
|
|
|
if screen -list | grep -q "$SCREEN_NAME"; then
|
2021-06-27 19:36:52 +00:00
|
|
|
screen -X -S "$SCREEN_NAME" stuff "stop^M"
|
2021-03-21 14:15:59 +00:00
|
|
|
sleep 5
|
2021-06-27 19:36:52 +00:00
|
|
|
if screen -list | grep -q "$SCREEN_NAME"; then
|
|
|
|
screen -X -S "$SCREEN_NAME" stuff "^C"
|
|
|
|
sleep 5
|
|
|
|
fi
|
2021-03-21 14:04:57 +00:00
|
|
|
|
2021-06-27 19:36:52 +00:00
|
|
|
if screen -list | grep -q "$SCREEN_NAME"; then
|
|
|
|
screen -X -S "$SCREEN_NAME" stuff "^C^C^C^C^C^C^C^C"
|
|
|
|
fi
|
2021-03-21 14:04:57 +00:00
|
|
|
|
2021-06-27 19:36:52 +00:00
|
|
|
if screen -list | grep -q "$SCREEN_NAME"; then
|
|
|
|
echo "Graceful Shutdown Failed. Please run tf!kill"
|
|
|
|
exit 1
|
|
|
|
else
|
|
|
|
echo "Server has been shut down succesfully."
|
|
|
|
fi
|
2021-03-21 14:15:59 +00:00
|
|
|
else
|
2021-06-27 19:36:52 +00:00
|
|
|
echo "$SARCASTIC_MESSAGE"
|
2021-03-21 14:15:59 +00:00
|
|
|
fi
|
2021-06-27 19:36:52 +00:00
|
|
|
fi
|