Systemd Configs Help Needed

So I’m trying to run a game server on Ubuntu Server 18.04 LTS and using Systemd to start the service. The problem I’m having is that when I start the service it only starts one unit of two and never finishes starting the service needing CTRL C to stop it. At this time I’m only doing some testing. My end goal is to have three to four units in the systemd service file. Any help is appreciated.

Thank You

Here is the config file as I have it now.

[Unit]
Description=ARK Survial Evolved

[Service]
Type=oneshot
Restart=no
RestartSec=5
StartLimitInterval=60s
StartLimitBurst=3
User=ark
Group=ark
ExecStartPre=/home/ark/steamcmd +login anonymous +force_install_dir /home/ark/server +app_update 376030 +quit
ExecStart=/home/ark/server/ShooterGame/Binaries/Linux/ShooterGameServer Ragnarok?listen?Port=7777?QueryPort=27015?SessionName=TheRevenger_Ragnarok_Test -server -USEALLAVAILABLECORES -log -clusterid=testclu
ExecStart=/home/ark/server/ShooterGame/Binaries/Linux/ShooterGameServer Aberration_P?listen?Port=7779?QueryPort=27016?SessionName=TheRevenger_Aberration_Test -server -USEALLAVAILABLECORES -log -clusterid=testclu
RemainAfterExit=true
ExecStop=/bin/killall -TERM srcds_linux

[Install]
WantedBy=multi-user.target

P.S. Other methods with the desired out come would be appreciated as well. Thank You

Fron the doc

Services declared as oneshot are expected to take some action and exit immediatelly (thus, they are not really services, no running processes remain). A common pattern for these type of service is to be defined by a setup and a teardown action.

I think you aren’t using the right type, i would go with simple or exec, but i don’t know the specific of the server

  • If set to simple (the default if ExecStart= is specified but neither Type= nor BusName= are), the service manager will consider the unit started immediately after the main service process has been forked off. It is expected that the process configured with ExecStart= is the main process of the service. In this mode, if the process offers functionality to other processes on the system, its communication channels should be installed before the service is started up (e.g. sockets set up by systemd, via socket activation), as the service manager will immediately proceed starting follow-up units, right after creating the main service process, and before executing the service’s binary. Note that this means systemctl start command lines for simple services will report success even if the service’s binary cannot be invoked successfully (for example because the selected User= doesn’t exist, or the service binary is missing).
  • The exec type is similar to simple , but the service manager will consider the unit started immediately after the main service binary has been executed. The service manager will delay starting of follow-up units until that point. (Or in other words: simple proceeds with further jobs right after fork() returns, while exec will not proceed before both fork() and execve() in the service process succeeded.) Note that this means systemctl start command lines for exec services will report failure when the service’s binary cannot be invoked successfully (for example because the selected User= doesn’t exist, or the service binary is missing).

But now you can’t have 2 execstart (and shouldn’t)
i would recommend 2 services, one per server.
You can go deeper and have a service template, but for now it will be good enough :slight_smile:

3 Likes

Thank you @vlycop for the help. I was hoping for one service for easy of use. So I’ll be looking into this service template and for now as long as I come up with a nice script. Multiple services should be alright. Thanks again

1 Like