I run a small private server on a ubuntu machine. It's on 24/7 for me and a couple of my friends, but I also use it to learn a bit about managing such gaming servers.
I want to restart it daily to free up some resources and let the process reset. I use a plugin for running a command or/and a script for restarting the process. The plugin stops the current process and runs the script below to restart it.
#!/bin/sh
while true
do
java -Xmmx16384M -Xms16384M -jar paper-1.18.1-108.jar nogui
sleep 30
done
The process stops just fine, the problem is the new process launched by the script doesn't run in the same terminal. System monitor indicated the process running, and sure enaugh you can join the server just fine. The problem occurs when I want to use the server terminal, as it is nowhere to be found. Using screen doesn't help either, the screen session stops where the original java stopped, yet the process starts to live somewhere else.
My question would be is there any way to 'tap into' the new process, to be able to input commands into it.
Or maybe I'm doing somthing wroung, and I should school myself on similar things, if so please could you provide me with resources?