First stab at getting the scripts in a slightly better setup ready for future expansion work

This commit is contained in:
Wild1145 2021-06-27 18:35:05 +01:00
parent cdeb526da4
commit cdeff8c58c
5 changed files with 59 additions and 26 deletions

10
FreeOP Servers/.env.sh Normal file
View file

@ -0,0 +1,10 @@
#!
# These ones should be server specific
JVM_HEAP="18G"
PAPER_JAR_NAME="paperclip.jar"
# DO NOT Change these ones
SCREEN_NAME="TotalFreedom"
SARCASTIC_MESSAGE="The server is not running... Why don't you try starting it? <3"
RESET_FILE=/home/tfserver/.resetting

View file

@ -1,13 +1,17 @@
#!
if screen -list | grep -q "TotalFreedom";
#Pull in the .env file for variables.
source .env.sh
if screen -list | grep -q "$SCREEN_NAME";
then
screen -X -S "TotalFreedom" stuff "^C^C^C^C^C^C^C^C^C^C^C^C^C"
screen -X -S "$SCREEN_NAME" stuff "^C^C^C^C^C^C^C^C^C^C^C^C^C"
sleep 5
else
echo "The server is not running... Try starting it <3"
echo "$SARCASTIC_MESSAGE"
fi
if screen -list | grep -q "TotalFreedom";
if screen -list | grep -q "$SCREEN_NAME";
then
fuser -k 25565/tcp
rm -f /home/tfserver/world/session.lock
@ -20,7 +24,7 @@ then
sleep 5
fi
if screen -list | grep -q "TotalFreedom";
if screen -list | grep -q "$SCREEN_NAME";
then
echo "Kill Command Failed. Please try again"
else

View file

@ -1,31 +1,35 @@
#!
#Pull in the .env file for variables.
source .env.sh
sleep 10
if screen -list | grep -q "TotalFreedom";
if screen -list | grep -q "$SCREEN_NAME";
then
screen -X -S "TotalFreedom" stuff "stop^M"
screen -X -S "$SCREEN_NAME" stuff "stop^M"
sleep 5
fi
if screen -list | grep -q "TotalFreedom";
if screen -list | grep -q "$SCREEN_NAME";
then
screen -X -S "TotalFreedom" stuff "^C"
screen -X -S "$SCREEN_NAME" stuff "^C"
sleep 5
fi
if screen -list | grep -q "TotalFreedom";
if screen -list | grep -q "$SCREEN_NAME";
then
screen -X -S "TotalFreedom" stuff "^C^C^C^C^C^C^C^C"
screen -X -S "$SCREEN_NAME" stuff "^C^C^C^C^C^C^C^C"
fi
if screen -list | grep -q "TotalFreedom";
if screen -list | grep -q "$SCREEN_NAME";
then
echo "Graceful Shutdown Failed. Please run tf!kill"
fi
if screen -list | grep -q "TotalFreedom";
if screen -list | grep -q "$SCREEN_NAME";
then
echo "ERROR - We have been unable to re-start the server... Please execute this manually"
else
screen -dmS TotalFreedom java -Xms18G -Xmx18G -XX:+CMSClassUnloadingEnabled -XX:ParallelGCThreads=2 -XX:MinHeapFreeRatio=5 -XX:MaxHeapFreeRatio=10 -jar paperclip.jar
screen -dmS $SCREEN_NAME java -Xms$JVM_HEAP -Xmx$JVM_HEAP -XX:+CMSClassUnloadingEnabled -XX:ParallelGCThreads=2 -XX:MinHeapFreeRatio=5 -XX:MaxHeapFreeRatio=10 -jar $PAPER_JAR_NAME
echo "Server Started"
fi

View file

@ -1,8 +1,19 @@
#!
if screen -list | grep -q "TotalFreedom";
#Pull in the .env file for variables.
source .env.sh
if test -f "$RESET_FILE";
then
echo "ERROR - There is an instance of the server already running. Make sure it is killed first and try again"
echo "CRITICAL ERORR - Server is currently re-setting. Please wait for this action to complete."
else
screen -dmS TotalFreedom java -Xms18G -Xmx18G -XX:+CMSClassUnloadingEnabled -XX:ParallelGCThreads=2 -XX:MinHeapFreeRatio=5 -XX:MaxHeapFreeRatio=10 -jar paperclip.jar
if screen -list | grep -q "$SCREEN_NAME";
then
echo "ERROR - There is an instance of the server already running. Make sure it is killed first and try again"
else
screen -dmS $SCREEN_NAME java -Xms$JVM_HEAP -Xmx$JVM_HEAP -XX:+CMSClassUnloadingEnabled -XX:ParallelGCThreads=2 -XX:MinHeapFreeRatio=5 -XX:MaxHeapFreeRatio=10 -jar $PAPER_JAR_NAME
echo "Server Started"
fi
fi

View file

@ -1,21 +1,25 @@
#!
if screen -list | grep -q "TotalFreedom"; then
screen -X -S "TotalFreedom" stuff "stop^M"
#Pull in the .env file for variables.
source .env.sh
if screen -list | grep -q "$SCREEN_NAME"; then
screen -X -S "$SCREEN_NAME" stuff "stop^M"
sleep 5
if screen -list | grep -q "TotalFreedom"; then
screen -X -S "TotalFreedom" stuff "^C"
if screen -list | grep -q "$SCREEN_NAME"; then
screen -X -S "$SCREEN_NAME" 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"
if screen -list | grep -q "$SCREEN_NAME"; then
screen -X -S "$SCREEN_NAME" stuff "^C^C^C^C^C^C^C^C"
fi
if screen -list | grep -q "TotalFreedom"; then
if screen -list | grep -q "$SCREEN_NAME"; 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"
echo "$SARCASTIC_MESSAGE"
fi