Jump to content

Autostart dedicated server on server start


Recommended Posts

Hello,

Apologies if this is mentioned already but I'd like to have it so that my dedicated server starts when my server boots.

I've followed the Dedicated server quick setup guide linux and I run the ./run_dedicated_server.sh scrip to start the server, but I'd like it to auto start when I boot my server and run as the user I've set up which is "steam".

I'm running this on Ubuntu 16.04, can anyone share some advice?

Thanks,

The question is not really specific to Don't Starve Together. It should be the same approach to start any application on boot in Ubuntu.

So there is lots of resources outside of forums for Klei / DST.

Are you on Ubuntu with GUI or Ubuntu Server? I'll assume Ubuntu Server / command line, there are other even easier solutions if you have Ubuntu GUI.

Try any of these:

http://tempvariable.blogspot.com/2009/07/how-to-add-program-to-run-at-startup-in.html

http://stackoverflow.com/questions/7221757/run-automatically-program-on-startup-under-linux-ubuntu

http://unix.stackexchange.com/questions/270746/how-can-i-start-program-on-boot-in-ubuntu-14-04

http://unix.stackexchange.com/questions/56957/how-to-start-an-application-automatically-on-boot

I eventually figured out how to get the script to run at boot on Ubuntu 16.04. I don't have the GUI installed as I'm running it as a headless server. Below is the result of my efforts and so hopefully it can help others.

  • Firstly we need to create a systemd startup script e.g. dst.service and place it into /etc/systemd/system/ directory. In my example below I created a seperate user, steam, for the script to be run as.
[Unit]
Description=Don't Starve Together Dedicated Server
Wants=network-online.target
After=network.target network-online.target

[Service]
ExecStart=/home/steam/run_dedicated_servers.sh
Restart=on-failure
User=steam

[Install]
WantedBy=multi-user.target
  • Then we need to enable the it so it will be executed at boot.
systemctl daemon-reload
systemctl enable dst.service
  • Once it's running you can run "systemctl status dst" and get output similair to the following:
● dst.service - Don't Starve Together Dedicated Server
   Loaded: loaded (/etc/systemd/system/dst.service; enabled; vendor preset: enabled)
   Active: active (running) since Sat 2016-10-29 19:08:53 BST; 24h ago
 Main PID: 3069 (run_dedicated_s)
    Tasks: 27
   Memory: 1.1G
      CPU: 6h 36min 7.239s
   CGroup: /system.slice/dst.service
           ├─3069 /bin/bash /home/steam/run_dedicated_servers.sh
           ├─3093 ./dontstarve_dedicated_server_nullrenderer -console -cluster MyDediServer -monitor_parent_process 3069 -shard Caves
           ├─3094 sed s/^/Caves:  /
           ├─3095 ./dontstarve_dedicated_server_nullrenderer -console -cluster MyDediServer -monitor_parent_process 3069 -shard Master
           └─3096 sed s/^/Master: /

Thanks,

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...