GameServer Service Setup

From Scottworld
Jump to navigation Jump to search

Firstly we need to create the service file in /etc/systemd/system/

nano /etc/systemd/system/MyGameServer.service

In this file we put all the details about the service we want to run.

Description=MyGameServer Server Control Script

User=gameserver     <---- this is username we want the service to run under
Group=gameserver    <---- this is the group we want the service to run under.
ExecStart=/srv/data/game_servers/scripts/       <---- here we point to the shell script that starts the server.


Now we reload the daemon, to read in the file we just created.

systemctl --system daemon-reload

Now enabled the service with

systemctl enable MyGameService.service

Now start the service with the cmd.

systemctl start MyGameService.service

Once you've started the server, you can check that it's running with this command.

systemctl status MyGameService.service