Skip to content

Instantly share code, notes, and snippets.

@nothub
Last active August 9, 2022 17:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nothub/155d229f8c4c763eb23be764e1367788 to your computer and use it in GitHub Desktop.
Save nothub/155d229f8c4c763eb23be764e1367788 to your computer and use it in GitHub Desktop.
[Unit]
# curl -L -O https://github.com/tracer4b/nomi-ceu/releases/download/1.3.5/nomi-ceu-server-1.3.5.zip \
# && mkdir -p /opt/server \
# && unzip nomi-ceu-server-1.3.5.zip -d /opt/server \
# && rm -f nomi-ceu-server-1.3.5.zip \
# && echo "eula=true" > /opt/server/eula.txt \
# && chown -R mc:mc /opt/server \
# && systemctl daemon-reload \
# && systemctl start nomi.service \
# && systemctl enable nomi.service
Description=Forge Nomifactory Server
Documentation=https://github.com/tracer4b/nomi-ceu
After=network.target
[Service]
Type=simple
User=mc
Group=mc
# jvm success exit code
SuccessExitStatus=143
# hardening
ProtectSystem=strict
ProtectHome=yes
PrivateTmp=yes
ProtectClock=yes
ProtectKernelTunables=yes
ProtectKernelModules=yes
ProtectKernelLogs=yes
ProtectControlGroups=yes
RestrictAddressFamilies=AF_INET
LockPersonality=yes
#MemoryDenyWriteExecute=yes # breaks application functionality
RestrictSUIDSGID=yes
RemoveIPC=yes
NoNewPrivileges=yes
WorkingDirectory=/opt/server
ReadWritePaths=/opt/server
# always restart the service
Restart=always
# sleep delay prior to restart
RestartSec=1
# maximum time until startup completion is required
TimeoutStartSec=600
TimeoutStopSec=60
# start jvm
ExecStart=java -server -Xms3G -Xmx3G -Dlog4j.configurationFile=log4j2_112-116.xml -jar forge-1.12.2-14.23.5.2860.jar nogui
[Install]
# if the service autostarts, the start should happen when the system and network is ready
# https://unix.stackexchange.com/questions/506347/why-do-most-systemd-examples-contain-wantedby-multi-user-target/506374#506374
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment