As a followup to one of my previous posts, I'm using systemd to run a GMod server on Ubuntu 18.04. My systemd script looks like this:
[Unit]
Description=Gmod Server
After=network.target
[Service]
User=rooday # the user I normally run run_gmod.sh with
ExecStart=/datadrive/srcds/run_gmod.sh
Restart=Always
[Install]
WantedBy=multi-user.target
and it runs my server fine, but the issue is that systemctl status
and journalctl
aren't showing the actual logs of the server binary.
This is because run_gmod.sh
runs the srcds_run
script (part of the srcds installation) with the parameters for my server (which gamemode, which map, etc). srcds_run
takes these parameters and sets some environment variables, and then runs the actual server binary (as well as has some logic to restart the server binary after a crash, update the server, etc.).
srcds_run
has a lot of logic so I don't want to bypass it and run the binary directly (unless someone more experienced with srcds servers thinks that's a better option), I'd rather just have systemctl
and journalctl
show the logs of the server binary. I tried using Type=forking
but then running systemctl restart gmod
would hang, so I'm not sure if that's the right option here. Does anyone know how to get the proper logs in systemctl
/a better way to run the server?