a guest Jan 23rd, 2020 308 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. [Unit]
  2. Description=Minecraft Server
  5. [Service]
  6. WorkingDirectory=/opt/minecraft-server/
  7. PrivateUsers=true
  8. # Users Database is not available for within the unit, only root and minecraft is available, everybody else is nobody
  9. User=mike
  10. Group=minecraft
  11. ProtectSystem=full
  12. # Read only mapping of /usr /boot and /etc
  13. ProtectHome=true
  14. # /home, /root and /run/user seem to be empty from within the unit. It is recommended to enable this setting for all long-running services (in particular network-facing ones).
  15. ProtectKernelTunables=true
  16. # /proc/sys, /sys, /proc/sysrq-trigger, /proc/latency_stats, /proc/acpi, /proc/timer_stats, /proc/fs and /proc/irq will be read-only within the unit. It is recommended to turn this on for most services.
  17. # Implies MountFlags=slave
  18. ProtectKernelModules=true
  19. # Block module system calls, also /usr/lib/modules. It is recommended to turn this on for most services that do not need special file systems or extra kernel modules to work
  20. # Implies NoNewPrivileges=yes
  21. ProtectControlGroups=true
  22. # It is hence recommended to turn this on for most services.
  23. # Implies MountAPIVFS=yes
  25. ExecStart=/bin/sh -c '/usr/bin/screen -DmS minecraft /usr/bin/java -server -Xms512M -Xmx2048M -XX:+UseG1GC -XX:+CMSIncrementalPacing -XX:+CMSClassUnloadingEnabled -XX:ParallelGCThreads=2 -XX:MinHeapFreeRatio=5 -XX:MaxHeapFreeRatio=10 -jar spigot.jar nogui'
  27. ExecReload=/usr/bin/screen -p 0 -S minecraft -X eval 'stuff "reload"\\015'
  29. ExecStop=/usr/bin/screen -p 0 -S minecraft -X eval 'stuff "say SERVER SHUTTING DOWN. Saving map..."\\015'
  30. ExecStop=/usr/bin/screen -p 0 -S minecraft -X eval 'stuff "save-all"\\015'
  31. ExecStop=/usr/bin/screen -p 0 -S minecraft -X eval 'stuff "stop"\\015'
  32. ExecStop=/bin/sleep 10
  34. Restart=on-failure
  35. RestartSec=60s
  37. [Install]
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand