mirror of
https://github.com/DarkflameUniverse/DarkflameServer
synced 2024-08-30 18:43:58 +00:00
chore: Notes for running as system service (#1252)
* Note for running as system service Note for running as system service * Additional detailing of linux service. * Added darkflame.service file changed readme to reference new file
This commit is contained in:
parent
d1dc9f5403
commit
2c9a98313a
38
README.md
38
README.md
@ -224,6 +224,44 @@ sudo setcap 'cap_net_bind_service=+ep' AuthServer
|
|||||||
```
|
```
|
||||||
and then go to `build/masterconfig.ini` and change `use_sudo_auth` to 0.
|
and then go to `build/masterconfig.ini` and change `use_sudo_auth` to 0.
|
||||||
|
|
||||||
|
### Linux Service
|
||||||
|
If you are running this on a linux based system, it will use your terminal to run the program interactively, preventing you using it for other tasks and requiring it to be open to run the server.
|
||||||
|
_Note: You could use screen or tmux instead for virtual terminals_
|
||||||
|
To run the server non-interactively, we can use a systemctl service by copying the following file:
|
||||||
|
```shell
|
||||||
|
cp ./systemd.example /etc/systemd/system/darkflame.service
|
||||||
|
```
|
||||||
|
|
||||||
|
Make sure to edit the file in `/etc/systemd/system/darkflame.service` and change the:
|
||||||
|
- `User` and `Group` to the user that runs the darkflame server.
|
||||||
|
- `ExecPath` to the full file path of the server executable.
|
||||||
|
|
||||||
|
To register, enable and start the service use the following commands:
|
||||||
|
|
||||||
|
- Reload the systemd manager configuration to make it aware of the new service file:
|
||||||
|
```shell
|
||||||
|
systemctl daemon-reload
|
||||||
|
```
|
||||||
|
- Start the service:
|
||||||
|
```shell
|
||||||
|
systemctl start darkflame.service
|
||||||
|
```
|
||||||
|
- Enable OR disable the service to start on boot using:
|
||||||
|
```shell
|
||||||
|
systemctl enable darkflame.service
|
||||||
|
systemctl disable darkflame.service
|
||||||
|
```
|
||||||
|
- Verify that the service is running without errors:
|
||||||
|
```shell
|
||||||
|
systemctl status darkflame.service
|
||||||
|
```
|
||||||
|
- You can also restart, stop, or check the logs of the service using journalctl
|
||||||
|
```shell
|
||||||
|
systemctl restart darkflame.service
|
||||||
|
systemctl stop darkflame.service
|
||||||
|
journalctl -xeu darkflame.service
|
||||||
|
```
|
||||||
|
|
||||||
### First admin user
|
### First admin user
|
||||||
Run `MasterServer -a` to get prompted to create an admin account. This method is only intended for the system administrator as a means to get started, do NOT use this method to create accounts for other users!
|
Run `MasterServer -a` to get prompted to create an admin account. This method is only intended for the system administrator as a means to get started, do NOT use this method to create accounts for other users!
|
||||||
|
|
||||||
|
19
systemd.example
Normal file
19
systemd.example
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
[Unit]
|
||||||
|
# Description of the service.
|
||||||
|
Description=Darkflame LEGO Universe Server
|
||||||
|
# Wait for network to start first before starting this service.
|
||||||
|
After=network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
# Services should have their own, dedicated, user account.
|
||||||
|
# The specific user that our service will run as, you can find your current user by issuing `id -un`
|
||||||
|
User=darkflame
|
||||||
|
# The specific group that our service will run as, you can find your current primary group by issuing `id -gn`
|
||||||
|
Group=darkflame
|
||||||
|
# Full Path to the darkflame server process
|
||||||
|
ExecStart=/PATH/TO/DarkflameServer/build/MasterServer
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
# Define the behavior if the service is enabled or disabled to automatically started at boot.
|
||||||
|
WantedBy=multi-user.target
|
Loading…
Reference in New Issue
Block a user