From 4e71b1835106beb6df6b8b608763b0dcd1c3a6e4 Mon Sep 17 00:00:00 2001 From: Ryan Wild Date: Sun, 21 Mar 2021 14:04:57 +0000 Subject: [PATCH] Added FreeOP Scripts This is as they currently stand, I know there are better ways to have set these up but they've worked okay for now. --- FreeOP Servers/README.md | 2 ++ FreeOP Servers/kill.sh | 28 ++++++++++++++++++++++++++++ FreeOP Servers/spigot-restart.sh | 31 +++++++++++++++++++++++++++++++ FreeOP Servers/start-agent.sh | 8 ++++++++ FreeOP Servers/start.sh | 8 ++++++++ FreeOP Servers/stop.sh | 24 ++++++++++++++++++++++++ 6 files changed, 101 insertions(+) create mode 100644 FreeOP Servers/README.md create mode 100644 FreeOP Servers/kill.sh create mode 100644 FreeOP Servers/spigot-restart.sh create mode 100644 FreeOP Servers/start-agent.sh create mode 100644 FreeOP Servers/start.sh create mode 100644 FreeOP Servers/stop.sh diff --git a/FreeOP Servers/README.md b/FreeOP Servers/README.md new file mode 100644 index 0000000..cc70232 --- /dev/null +++ b/FreeOP Servers/README.md @@ -0,0 +1,2 @@ +# TF-Scripts +Various scripts we use to manage the TF Servers diff --git a/FreeOP Servers/kill.sh b/FreeOP Servers/kill.sh new file mode 100644 index 0000000..cab5686 --- /dev/null +++ b/FreeOP Servers/kill.sh @@ -0,0 +1,28 @@ +#! +if screen -list | grep -q "TotalFreedom"; +then + screen -X -S "TotalFreedom" 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" +fi + +if screen -list | grep -q "TotalFreedom"; +then + fuser -k 25565/tcp + rm -f /home/tfserver/world/session.lock + rm -f /home/tfserver/flatlands/session.lock + rm -f /home/tfserver/hubworld/session.lock + rm -f /home/tfserver/masterbuilderworld/session.lock + rm -f /home/tfserver/plotworld/sesssion.lock + rm -f /home/tfserver/world_nether/session.lock + rm -f /home/tfserver/world_the_end/session.lock + sleep 5 +fi + +if screen -list | grep -q "TotalFreedom"; +then + echo "Kill Command Failed. Please try again" +else + echo "Graceful Shutdown Complete! Yay TotalFreedom" +fi diff --git a/FreeOP Servers/spigot-restart.sh b/FreeOP Servers/spigot-restart.sh new file mode 100644 index 0000000..9ff85ea --- /dev/null +++ b/FreeOP Servers/spigot-restart.sh @@ -0,0 +1,31 @@ +#! +sleep 10 +if screen -list | grep -q "TotalFreedom"; +then + screen -X -S "TotalFreedom" stuff "stop^M" + sleep 5 +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 + +if screen -list | grep -q "TotalFreedom"; +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 + echo "Server Started" +fi diff --git a/FreeOP Servers/start-agent.sh b/FreeOP Servers/start-agent.sh new file mode 100644 index 0000000..df66546 --- /dev/null +++ b/FreeOP Servers/start-agent.sh @@ -0,0 +1,8 @@ +#! +if screen -list | grep -q "jAgent"; +then + echo "ERROR - There is already an instance of the agent running." +else + screen -dmS jAgent java -Xms2G -Xmx2G -jar jagent-1.0.jar + echo "Agent Started" +fi diff --git a/FreeOP Servers/start.sh b/FreeOP Servers/start.sh new file mode 100644 index 0000000..f6625eb --- /dev/null +++ b/FreeOP Servers/start.sh @@ -0,0 +1,8 @@ +#! +if screen -list | grep -q "TotalFreedom"; +then + echo "ERROR - There is an instance of the server already running. Make sure it is killed first and try again" +else + screen -dmS TotalFreedom java -Xms18G -Xmx18G -XX:+CMSClassUnloadingEnabled -XX:ParallelGCThreads=2 -XX:MinHeapFreeRatio=5 -XX:MaxHeapFreeRatio=10 -jar paperclip.jar + echo "Server Started" +fi diff --git a/FreeOP Servers/stop.sh b/FreeOP Servers/stop.sh new file mode 100644 index 0000000..0ccc4a1 --- /dev/null +++ b/FreeOP Servers/stop.sh @@ -0,0 +1,24 @@ +#! +if screen -list | grep -q "TotalFreedom"; +then + screen -X -S "TotalFreedom" stuff "stop^M" + sleep 5 +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