Xonotic Forums
Start server_linux.sh on boot? - Printable Version

+- Xonotic Forums (https://forums.xonotic.org)
+-- Forum: Support (https://forums.xonotic.org/forumdisplay.php?fid=3)
+--- Forum: Xonotic - Server Administration (https://forums.xonotic.org/forumdisplay.php?fid=16)
+--- Thread: Start server_linux.sh on boot? (/showthread.php?tid=3939)



Start server_linux.sh on boot? - end user - 02-08-2013

I need to start the server on boot in Debian. Can I move server_linux.sh to /etc/init.d/ like on here http://www.debian-administration.org/article/Making_scripts_run_at_boot_time_with_Debian

Is so do I have to adjust the file paths in the script? Also will it be running as root on another user?

Thanks


RE: Start server_linux.sh on boot? - Mr. Bougo - 02-09-2013

You can't move server_linux.sh there, the script expects the server binary to be in the same directory. What you can do, however, is make a small shell script that cd's into the directory of server_linux.sh and launches it. That should be simple enough.

Please do not run the server as root (or anything else that does not require it.) In your init.d script, you can use su to launch server_linux.sh as a different user.

EDIT: For your info, you might want to look into this: Debian's start-stop-daemon can launch daemons as other users. Also, it might be interesting to launch server_linux.sh inside a GNU screen or tmux session, because it spawns an interactive admin console which is more convenient to use than rcon (and also shows the game log live). Then you can just resume the screen session from ssh and see what's happening on your server or issue server commands directly in it. If you're running a server that needs good supervision, I suggest having a look at rcon2irc too, it's an administration tool that relays server events to an irc channel and, if you know Perl, you can code modules for it.


RE: Start server_linux.sh on boot? - end user - 02-09-2013

(02-09-2013, 04:24 AM)Mr. Bougo Wrote: Also, it might be interesting to launch server_linux.sh inside a GNU screen or tmux session


Thats what I end up doing (tmux) but wasn't sure if it was the right way to go about doing it. Hotting Ctrl-b d detached the session and I was able to close my ssh window.

Would still like an auto start just incase the server provider decides to restart the VPS server.


RE: Start server_linux.sh on boot? - Mr. Bougo - 02-09-2013

Did my post above help for autostarting?


RE: Start server_linux.sh on boot? - end user - 02-09-2013

(02-09-2013, 12:55 PM)Mr. Bougo Wrote: Did my post above help for autostarting?


Sorry I haven't set up the Debian way auto start but before I posted this I found tmux which let me run the script after closing the ssh session. So yes tmux did the job for now I'll do some more reading today and get the auto start going and how to control the xonotic server.

If I get the auto start going then I'll repost how I did it.



Thanks.


RE: Start server_linux.sh on boot? - Mr. Bougo - 02-09-2013

You can make the auto start script launch the server in a detached tmux session. Then you can attach later.

EDIT: I believe this is done with the '-d' argument to new-session: (disclaimer: I'm not a tmux user)
Code:
cd /path/to/xonotic/directory/
tmux new-session -d -s my_xonotic_server 'sh ./server_linux.sh'



RE: Start server_linux.sh on boot? - zykure - 02-09-2013

Couldn't you just run it within a screen session as well? After all, a dedicated server doesn't need no X11, so why tmux? Smile


RE: Start server_linux.sh on boot? - end user - 02-09-2013

(02-09-2013, 06:34 PM)zykure Wrote: Couldn't you just run it within a screen session as well? After all, a dedicated server doesn't need no X11, so why tmux? Smile

I'm sure I could but I don't know what I'm going LOL - just Micky Mousing it for now as I read up on things.. I believe there is a native command to detach the session but tmux is working really nice.

The game server seems to be running good so now I need to harden the main server. iptables is making me scratch my head atm heh


RE: Start server_linux.sh on boot? - Mr. Bougo - 02-09-2013

(02-09-2013, 06:34 PM)zykure Wrote: Couldn't you just run it within a screen session as well? After all, a dedicated server doesn't need no X11, so why tmux? Smile

tmux is a terminal multiplexer like screen.


RE: Start server_linux.sh on boot? - JayWalker - 02-10-2013

I recall It'sMe wrote some software for handling multiple xonotic servers in different tmux sessions and abstracting out the whole management process pretty well. May want to have a look: https://github.com/itsme-/xstools


RE: Start server_linux.sh on boot? - zykure - 02-10-2013

(02-09-2013, 07:55 PM)Mr. Bougo Wrote: tmux is a terminal multiplexer like screen.

... and it's awesome! Why didn't I know about this before??! Big Grin