T3D dedicated server, running in its own thread?
by Chris Calef · in Torque 3D Professional · 02/03/2013 (10:57 pm) · 2 replies
So, I have a T3D build that I can run online as a dedicated server in an Ubuntu virtual machine.
Everything is peaches and cream, _except_ for the fact that it seems I cannot run this server without an open terminal window.
The server is hosted on Amazon Web Services, and I can start the game in a terminal, and it runs as long as I keep this terminal connection open, but if I close that terminal for any reason, such as to power down my machine at home, then my server dies.
I have tried to start the server using cron, using the rc.local script, and by adding "&" to the end of the command line to get it to make its own thread - however, every time it gets only slightly into the load process and then kills itself. This happens whether it is online on AWS or at home on my ubuntu laptop - if it does not have a console connection to talk to, it dies.
The point in the console output where it dies is right after "--------------- Loading DIRS -----------".
It seems that I am doing something wrong, but I am wondering if anyone else has any idea what is going on here, or what the proper way to start a dedicated server might be if you intend to fire it up over SSH and then go away and leave it running?
Thanks in advance!
Chris
Everything is peaches and cream, _except_ for the fact that it seems I cannot run this server without an open terminal window.
The server is hosted on Amazon Web Services, and I can start the game in a terminal, and it runs as long as I keep this terminal connection open, but if I close that terminal for any reason, such as to power down my machine at home, then my server dies.
I have tried to start the server using cron, using the rc.local script, and by adding "&" to the end of the command line to get it to make its own thread - however, every time it gets only slightly into the load process and then kills itself. This happens whether it is online on AWS or at home on my ubuntu laptop - if it does not have a console connection to talk to, it dies.
The point in the console output where it dies is right after "--------------- Loading DIRS -----------".
It seems that I am doing something wrong, but I am wondering if anyone else has any idea what is going on here, or what the proper way to start a dedicated server might be if you intend to fire it up over SSH and then go away and leave it running?
Thanks in advance!
Chris
About the author
#2
02/04/2013 (10:56 am)
Ah, great, I knew you'd know! :-) Thank you so much. Will try this as soon as I get the chance.
Associate Fyodor -bank- Osokin
Dedicated Logic
when launched without params it will start new shell session in a separate thread and attach the terminal to it.
To get out / close it, simply log off.
To "detach" from it: Ctrl+A + Ctrl+D.
To re-attach to previous session: screen -r PID or screen -r name
For our game I'm using following helper scripts:
You can find more information about it by checking out man screen
If I run it from the shell, it will launch a new screen session with name 'server1', and I can attach to it by:
screen -r server1
Press Ctrl+A than Ctrl+D to detach from the server.
Another way of keeping the server online:
With that way, you will only need to call 'run.sh' once, and it will launch the screen session with '_go.sh' script.
If the server reboots/crashes, it will automatically restart while it finds file 'run.lock' in the same folder. Remove/rename that file and server will not restart (screen session will terminate) when server exits.
Hope this helps ;)
There are a lot of different stuff you can do with 'screen', but this is are basics which should be enough to start playing with it.