0

I have an IRC bot which accepts commands from users to host specific game servers. However, after about half an hour to an hour of having the server up, the server just freezes up. The server is ran using Java's runtime execute command.

Is there a way to keep the server up until the user manually terminates the server?

If it matters, the OS is CentOS 6, 64bit.

Here is an example string command that is passed through to Java's runtime exectute: http://pastebin.com/mn8qWf3E

Edit: I'm not sure if the process hangs or crashes, as I did not check. I've ran the server again and will check once I find out.

Thank you!

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
Ivan
  • 87
  • 1
  • 7
  • 1
    Implement the recommendations of the article linked from the [runtime.exec info. page](http://stackoverflow.com/tags/runtime.exec/info). If that does not solve the problem, or give you enough information to solve the problem, post an [SSCCE](http://sscce.org/). As it is we could only guess why it is failing, and I for one don't like guessing. – Andrew Thompson Jul 31 '12 at 00:31

1 Answers1

0

just a guess.. make sure you keep reading the output of the server from the java process , or redirect it somewhere. otherwise it will block when it prints something in stdout or err

Markus Mikkolainen
  • 3,397
  • 18
  • 21
  • I assume I'd have to output it to a file rather than using System.out.println() if I wanted to have multiple servers? – Ivan Jul 31 '12 at 00:12
  • umm when you do a runtime exec, it will return a Process i think , and it will have a get-method for stdout and err. you need to keep reading those to make sure the buffers get emptied. – Markus Mikkolainen Jul 31 '12 at 00:18