Can I keep Mono from hanging up when I close my SSH connection?

6

2

I have a headless Linux server that I connect to through SSH. I recently started using it, in addition to its normal tasks, to host a game server written in C# with Mono. It performs admirably! However, if I disconnect from my SSH session, it hangs up and game clients disconnect.

To start the game server, I run the command mono KMPServer.exe. After this, the server software starts and displays configuration information - however, the game server is not running until I type /start.

I can't use nohup because of that - the process of starting the server involves first running it with mono, then interacting with it with it to issue a "/start" command. Interestingly, I can't background the process either (Is this normal for Mono?).

Is there any way to run it in a way to keep the game server from closing when I disconnect the SSH session?

Summary:

  • The server software is a third-party multiplayer server (part of a mod) for Kerbal Space Program.
  • The Linux server is running Arch Linux x86_64.
  • The installed Mono version is 3.2.3

dotVezz

Posted 2013-12-20T15:57:34.647

Reputation: 529

Answers

6

Sounds like you should be able to use a screen session. If you are unfamiliar with the screen tool, check out the man pages or visit Screen Command Examples: Get Control of Linux / Unix Terminal.

First, install it with pacman -S screen. Then start a new session with screen mono KMPServer.exe, perform all you need to do and detach the session with Ctrl+A+D. If you need to attach the session again, use screen -x.

zachzins

Posted 2013-12-20T15:57:34.647

Reputation: 181

1Ah, I hadn't thought of that! It works perfectly! – dotVezz – 2013-12-20T21:20:00.933