3

I currently have a private server which I test my web apps on which runs Ubuntu Server 10.04 I also host a few game servers (rather than having wasted CPU time :-D) for some of my friends.

These game servers I run in the game user account and each one has it's own screen session (so friends can ssh in and reboot the game server etc...). For example screen -R l4d2 runs ./start in the L4D2 folder.

However if I reboot the server (which I have to do occasionally) all these sessions close and I have to manually create all the screen sessions and run the required games within them.

Is there a way to set these screen sessions as Daemons or services or just boot on server start so they restart themselves on server reboot?

I hope I have made my question easy to understand but feel free to ask questions!

Many thanks,

4

From the screen manpage

 -d -m   Start screen in "detached" mode. This creates a new session but
           doesn't  attach  to  it.  This  is  useful  for  system startup
           scripts.

I'd probably be tempted to put something in /etc/rc.local which looked a bit like

su - <gameuser> -c "screen -d -m /var/games/l4d2/run_the_server"
2
  • As far as I know, unused arguments to screen isn't treated as a program to run, so: su -c 'screen -d -m /var/games/l4d2/run_the_server' - <gameuser> – Kjetil Jørgensen Jan 5 '11 at 15:24
  • Yep, you're right. I'm sure i had those to begin with.. – Tom O'Connor Jan 5 '11 at 15:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.