Jump to content

Autostart Server on linux boot


Recommended Posts

Hi, 

 

maybe there is a topic similar to mine, than I am sorry for double posting.

 

Is there a way to autostart the server on linux boot up. 

I've got an little linux pc which is running an xbmc, so I put the start up script in my .bashrc.

But then screen is always automatically terminated. 

 

Does someone know a soloution ? 

 

Thanks in advance 

 

Nevyen

Link to comment
Share on other sites

That's good, because this is easy then.  Just make an init-script for it, test, and make your machine start up on it.

 

https://mobiarch.wordpress.com/2014/05/16/creating-an-init-script-in-ubuntu-14-04/

 

Is the first reference I found that looked sane on a quick google search, but there are a ton of others out there because this is a pretty basic system administration task.

Link to comment
Share on other sites

Hi, thanks for this hint, 

 

now I had to run the server without screen because it doesn't work for me with the init script. 

 

I have two more questions: 

Is it now possible to sent a shutdown command to the server without running the game ? 

 

And 

Is there a way to look if the server is empty/paused to shutdown the server after about 30 minutes the last player left the game. 

This would be a nice feature to save some money ;) 

 

Thanks 

Link to comment
Share on other sites

You can start or stop any init-script by something like "/etc/init.d/$service start" or "stop".

 

I don't know how the program itself will handle being shutdown via the init script -- likely it'll work just fine because init scripts are pretty common, but it's possible Klei didn't build considering them and it might fail to save the world.  Some testing might be warranted on your part, or Klei might have answered that question already.

 

@rezecib would probably know off-hand.

 

I'm afraid I have no clue on if it's possible to see if the server is empty or paused.  But if it is possible to get that info then it should be possible to write a script that could invoke /etc/init.d/$whatever-you-named-your-startup-script.  I don't know of such a thing however, sorry.

Link to comment
Share on other sites

Hey, the init script only calls the startup script from the wiki but without screen. So the server is running as user steam and I can't access the server console.

 

If I shutdown my pc by click the shutdown button the world isn't save.

 

Maybe there is a way to run the init script with screen and than you can also run init stop with connecting to screen and send schutdown(true).

 

And to get the information about an empty server would be a nice feature.  

Link to comment
Share on other sites

The most simple and probably best way to make your DST server start at reboot is to add it as an @reboot cron job. It will be started at boot time, shortly after the cron service starts.

@reboot               ~/bin/myapp.sh
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...