summaryrefslogtreecommitdiff
path: root/examples/minecserver@.service
blob: 40aca8678506568eb7112878573e561773a27ee5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
[Unit]
Description=Minecraft Server %i
#Documentation= https://url https://url man:abc
Wants=network-online.target
After=network-online.target
ConditionFileNotEmpty=%E/minecproxy/%i.mcserver
# Unfortunately $XDG_DATA_DIR has no %E equivalent
ConditionPathExists=%h/.local/share/minecproxy/%i/eula.txt
ConditionPathExists=%h/.local/share/minecproxy/%i/server.properties
ConditionPathExists=%h/.local/share/minecproxy/%i/server.jar

[Service]
Type=exec
ExecStart=/usr/bin/java -Xmx1024M -Xms1024M -jar server.jar --nogui
ExecStop=-/usr/bin/minecctl -f stop %i
# Optional: this will autogenerate new servers on the fly
# if this is used, comment out all the ConditionPathExists checks above
#ExecStartPre=/usr/bin/minecctl new %i
TimeoutStopSec=120
KillSignal=SIGCONT
Restart=on-failure
WorkingDirectory=%h/.local/share/minecproxy/%i
Nice=5
LimitCORE=0
NoNewPrivileges=true
KeyringMode=privat
PrivateUsers=true
ProtectSystem=strict
ReadWritePaths=%h/.local/share/minecproxy/%i
PrivateDevices=true
ProtectKernelTunables=true
ProtectControlGroups=true
RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6
RestrictNamespaces=true
LockPersonality=true
RestrictSUIDSGID=true
PrivateTmp=true