-
Notifications
You must be signed in to change notification settings - Fork 0
/
minecraft.service
33 lines (27 loc) · 1015 Bytes
/
minecraft.service
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
[Unit]
Description=Minecraft Server
After=network.target
[Service]
User=minecraft
Group=minecraft
ProtectHome=true
ProtectSystem=full
PrivateDevices=true
ProtectKernelTunables=true
ProtectKernelModules=true
ProtectControlGroups=true
NoNewPrivileges=true
InaccessibleDirectories=/root /sys /srv/backups -/opt /media -/lost+found
ReadWriteDirectories=/srv/minecraft
WorkingDirectory=/srv/minecraft/mc.example.com
ExecStart=/usr/bin/screen -mDS "mc.example.com" /bin/bash -c "/usr/bin/java -Xms10G -Xmx10G -DIReallyKnowWhatIAmDoingISwear -jar /srv/minecraft/mc.example.com/paper.jar nogui"
ExecStop=/usr/bin/screen -p 0 -S mc.example.com -X eval 'stuff "say SERVER SHUTTING DOWN IN 10 SECONDS. SAVING ALL MAPS..."\015'
ExecStop=/bin/sleep 10
ExecStop=/usr/bin/screen -p 0 -S mc.example.com -X eval 'stuff "save-all"\015'
ExecStop=/usr/bin/screen -p 0 -S mc.example.com -X eval 'stuff "stop"\015'
KillMode=control-group
SuccessExitStatus=0 1
Restart=on-failure
RestartSec=30
[Install]
WantedBy=multi-user.target