ID:2538795
 
As the title, I'm running the command

DreamDaemon [game].dmb [port] -trusted -core -invisible -log server.log &

Yet whenever I close the SSH connection, I lose connection to the game.

Hopefully an easy fix, but I'm completely new to using the terminal, so I have no idea what's happening.
Sometimes SSH just does this, I've learned not to trust the usage of & personally.

Instead, leave the & off and hit ctrl+z while the process is in the foreground then use the "bg" command to force it into the background then use the "logout" command to gracefully disconnect.
In response to Nadrew
Nadrew wrote:
Sometimes SSH just does this, I've learned not to trust the usage of & personally.

Instead, leave the & off and hit ctrl+z while the process is in the foreground then use the "bg" command to force it into the background then use the "logout" command to gracefully disconnect.

It worked! Thanks a bunch
You could additionally use screen to put DD in another screen/process.
The reason this happens is because the command you ran with & still belongs to the SSH session, as a child process in the process tree. Depending on the shell you use, backgrounding a process may or may not also make the process independent of the SSH session when you logout, depending on how you logout blah blah.

The general idea is you want to disconnect/disown the process from your SSH session. There's a bunch of ways to do that. screen/txmux is a handy one if you need to restore an interactive session (like having an editor open with unsaved data in it etc).

The general thing you are looking to prevent is the process (e.g DreamDaemon) receiving a SIGHUP (hangup signal), which is sent to child processes when a session ends. If you've gone the bg route, disown -h [pid] will achieve that for you.

If you are launching DreamDaemon as part of a script though, you probably don't want to have to use Ctrl + Z to suspend the process, you'd rather it was just put into the background as part of the script. You can achieve that with something like:

nohup DreamDaemon game.dmb &

nohup performs the same function as disown -h, preventing the DreamDaemon process receiving a SIGHUP signal, and & as you already know will run the command in the background.