I have recently set up my game server on a linux OS and am using SSH to run the java file which runs the game server. In order for me to be able to exit the SSH session but keep the server running, I am using nohup and creating a script which does this for me:
#!/bin/bash
cd "RSPS"
echo "Booting the RSPS..."
nohup java -Xmx220m -cp bin:lib/* com.ruseps.GameServer &
I can see the status of my server then at any time by using the tail
command like so:
#!/bin/bash
cd "RSPS"
tail -f nohup.out
However, my server has shutdown hooks which expects the java file to be exited therefor running top
and then kill
ing the PID of the service ignored the shutdown hook thus breaking the 'save' state and making my server unbootable.
Is there a way I can reopen the process and softly kill the service, ie like exiting it so the file can run the shutdown hook?
What I am currently doing, which is not running the shutdown hook is using this via command line:
top
kill PID_HERE