papermc/templates/papermc.service.j2
author Luke Hoersten <luke@hoersten.org>
Wed, 01 Jul 2020 15:47:58 -0500
changeset 108 f00f45a9512d
parent 33 ad75fc2d2853
permissions -rw-r--r--
Optimized jvm flags for paper.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
19
31de177274a1 Added minecraft server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     1
[Unit]
33
ad75fc2d2853 Added papermc role.
Luke Hoersten <luke@hoersten.org>
parents: 19
diff changeset
     2
Description=PaperMC Server
ad75fc2d2853 Added papermc role.
Luke Hoersten <luke@hoersten.org>
parents: 19
diff changeset
     3
Documentation=https://paper.readthedocs.io/en/latest/server/getting-started.html
19
31de177274a1 Added minecraft server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     4
31de177274a1 Added minecraft server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     5
Wants=network.target
31de177274a1 Added minecraft server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     6
After=network.target
31de177274a1 Added minecraft server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     7
31de177274a1 Added minecraft server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     8
[Service]
33
ad75fc2d2853 Added papermc role.
Luke Hoersten <luke@hoersten.org>
parents: 19
diff changeset
     9
User={{papermc_user}}
ad75fc2d2853 Added papermc role.
Luke Hoersten <luke@hoersten.org>
parents: 19
diff changeset
    10
Group={{papermc_user}}
ad75fc2d2853 Added papermc role.
Luke Hoersten <luke@hoersten.org>
parents: 19
diff changeset
    11
WorkingDirectory={{papermc_dir}}
19
31de177274a1 Added minecraft server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    12
Restart=on-failure
31de177274a1 Added minecraft server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    13
RestartSec=20 5
108
f00f45a9512d Optimized jvm flags for paper.
Luke Hoersten <luke@hoersten.org>
parents: 33
diff changeset
    14
# ExecStart=/usr/bin/java -Xms{{papermc_mem}} -Xmx{{papermc_mem}} -jar server.jar
f00f45a9512d Optimized jvm flags for paper.
Luke Hoersten <luke@hoersten.org>
parents: 33
diff changeset
    15
# Optimizations from https://aikar.co/2018/07/02/tuning-the-jvm-g1gc-garbage-collector-flags-for-minecraft/
f00f45a9512d Optimized jvm flags for paper.
Luke Hoersten <luke@hoersten.org>
parents: 33
diff changeset
    16
ExecStart=/usr/bin/java -Xms{{papermc_mem}} -Xmx{{papermc_mem}} -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=15 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1 -Dusing.aikars.flags=https://mcflags.emc.gs -Daikars.new.flags=true -jar server.jar nogui
19
31de177274a1 Added minecraft server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    17
31de177274a1 Added minecraft server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    18
PrivateTmp=true
31de177274a1 Added minecraft server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    19
ProtectSystem=full
31de177274a1 Added minecraft server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    20
NoNewPrivileges=true
31de177274a1 Added minecraft server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    21
PrivateDevices=true
31de177274a1 Added minecraft server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    22
31de177274a1 Added minecraft server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    23
[Install]
31de177274a1 Added minecraft server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    24
WantedBy=multi-user.target