Jump to content

My minecraft server shuts down when I terminate my ssh session...

Handmeat

So I have an HPZ600 box running ubuntu server with a modded minecraft server living on it. Now, it's been a very long time since I messed with minecraft and this is the first time I have hosted on a box other than my local machine or rented space on the internet; but something curious happened last night. 

 

As the whole thing is headless, I SSH in from my personal rig to the server box both to set it up and to actually start the server and do things from console. Now, last night (or more accurately this morning), when I decided it was time to go to bed, I killed my ssh session (happened both with powershell and PuTTY) and the server shut down. Now, my theory is that by killing the session, it logged out my user and therefore killed any active processes, but that doesn't feel right, as it should just leave everything running, right? Running Ubuntu Server 18.04 and the modpack is Life in The Village 1.14. Any help would be muchly appreciated as I like to put my pc to sleep when I go to sleep as the RGB is rather bright...

 

Edit: I feel bad for not thoroughly googling this first. Apparently I need to use screen to actually start the server in a seperate terminal. I think I can figure out how to do that. 

Edited by Handmeat
fairly certain I answered my own question...
Link to comment
Share on other sites

Link to post
Share on other sites

Screen sets up a "virtual" terminal on the server that you can connect to once you connect via SSH.

 

The reason that the servier dies when you kill the terminal without doing this is that by default it is created as a child process of the open SSH connection.  When the parent process is killed, the child processes are also killed.

Link to comment
Share on other sites

Link to post
Share on other sites

2 minutes ago, KarathKasun said:

Screen sets up a "virtual" terminal on the server that you can connect to once you connect via SSH.

 

The reason that the servier dies when you kill the terminal without doing this is that by default it is created as a child process of the open SSH connection.  When the parent process is killed, the child processes are also killed.

So just to make sure I understand this, I can just run screen as a command and it will give me new terminal window from within which I can then start the server itself? or Can I just include screen in my server start script?

Link to comment
Share on other sites

Link to post
Share on other sites

Method A (I prefer):

run “screen”

run your startup script

once you see the server is good, press Ctrl+A then D (Ctrl+A means enter a command, D means Disconnect)

you are now safe to log out. If you want to reattach to the screen virtual terminal, run “screen -r”. Remember to disconnect from screen before closing your SSH session.

 

Method B:

you can run “screen” followed by your script, and it will do everything in one command. Check the help documentation for screen.

Looking to buy GTX690, other multi-GPU cards, or single-slot graphics cards: 

 

Link to comment
Share on other sites

Link to post
Share on other sites

18 minutes ago, brwainer said:

Method A (I prefer):

run “screen”

run your startup script

once you see the server is good, press Ctrl+A then D (Ctrl+A means enter a command, D means Disconnect)

you are now safe to log out. If you want to reattach to the screen virtual terminal, run “screen -r”. Remember to disconnect from screen before closing your SSH session.

 

Method B:

you can run “screen” followed by your script, and it will do everything in one command. Check the help documentation for screen.

Thank you very much!

Link to comment
Share on other sites

Link to post
Share on other sites

Just add the minecraft start script as a service so it auto starts when they server boots.

Gaming Machine: CPU: AMD 7950x cooled by a Custom Watercooling Loop| CASE: Lian Li Dynamic Evo | MOBO: X670E Asus Crosshair Extreme RAM: 64B DDR4 G.Skill 6000mhz ram | GPU: AMD 7900 XTX PSU: Corsair RM1000x with cablemod cables SSD's: 2TB Seagate 530, 4TB Seagate 530, 1TB WD SN850 | Monitors: 38" Acer X38P Predator| Mouse: Logitech G903 and Powerplay matt | KEYBOARD: Steelseries Apex mini pro | HEADSET: Logitech G935 Wireless Headset
   

| Pics of my rig |

 

Linux Machine: CPU: AMD 5950x cooled by a Custom Watercooling Loop| CASE: Phantek Evolv X | MOBO: X570 Asus Crosshair VIII Extreme RAM: 64GB DDR4 Crucial Ballistix 3600mhz ram | GPU: AMD 6900XT PSU: Corsair AX1200 with custom white sleeved Cables  SSD's: 1Tb Seagate 530 & 2Tb Seagate 530 & 2Tb KC3000 | Monitors: 38" Acer X38P Predator | Mouse: Logitech G903 and Powerplay matt | KEYBOARD: Steelseries Apex Pro| HEADSET: Logitech G935 Wireless Headset

 

| Pics of my rig |

 

 

Basement Machine: CPU: AMD 5950x cooled by a Custom Watercooling Loop| CASE: Thermaltake Core Pro 3 | MOBO: X570 Gigabyte Xtreme RAM: 64GB DDR4 G.Skill 3600mhz ram | GPU: Rtx 3080 Ti PSU: Corsair RM1000x  SSD's: 1Tb Crucial P3 Plus & 2Tb SN850 & 2Tb KC3000 | Monitors: 32" 1440p monitor | Mouse: Logitech G903 and Powerplay matt | KEYBOARD: Das Ultimate| HEADSET: Logitech G935 Wireless Headset

 

Link to comment
Share on other sites

Link to post
Share on other sites

I use Tmux on my linux box. works quite well.

PC Editing / Gaming Rig Specs : i7-3930k @ 4ghz w/ Hyper 212 Evo | 840 Evo 250gb and Seagate 1TB | 2x8GB Corsair Vengeance RAM | Zotac GTX 780 | Corsair Vengeance C70 Green | OS: Ubuntu 16.04 LTS / Win10 #KilledMyWife #MakeBombs

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×