Added a simple systemd service (#5)

Co-authored-by: Sanae <32604996+Sanae6@users.noreply.github.com>
This commit is contained in:
Piplup 2022-07-01 19:10:15 +01:00 committed by GitHub
parent ead6292f94
commit aec13bb4a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 1 deletions

View File

@ -20,6 +20,15 @@ dotnet run --project Server/Server.csproj -c Release
```
If you ran `dotnet build` instead of `dotnet run`, you can find the binary at `Server/bin/net6.0/Release/Server.exe`
## Running under systemd
If you have systemd, you can use the existing systemd serivce.
```shell
cp smo.serivce /etc/systemd/system/smo.service
# edit ExecStart to your path for the server executable and change WorkingDirectory to the server directory
chmod +x filepath to the server executable
systemctl enable --now smo.service
```
## Commands
@ -27,4 +36,4 @@ Run `help` to get what commands are available in the server console.
Run the `loadsettings` command in the console to update the settings without restarting.
Server address and port will require a server restart, but everything else should update when you run `loadsettings`.
[//]: # (TODO: Document all commands, possibly rename them too.)
[//]: # (TODO: Document all commands, possibly rename them too.)

19
smo.service Normal file
View File

@ -0,0 +1,19 @@
[Unit]
Description="Super Mario Odyssey Multiplayer Server"
After=network.target
StartLimitIntervalSec=0
[Service]
# Uncommnt User to run under a different user
# User=user
# change ExecStart to the path of the server file
ExecStart="/home/user/SMOServer/Server"
# change WorkingDirectory to the folder of your server
WorkingDirectory=/home/user/SMOServer/
# ensure the service restarts after crashing
Restart=always
# amount of time to wait before restarting the service
RestartSec=5
[Install]
WantedBy=multi-user.target