Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2020
1,684
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.80 KB | None | 0 0
  1. [Unit]
  2. Description=Minecraft Server
  3. After=network.target
  4.  
  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
  24.  
  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'
  26.  
  27. ExecReload=/usr/bin/screen -p 0 -S minecraft -X eval 'stuff "reload"\\015'
  28.  
  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
  33.  
  34. Restart=on-failure
  35. RestartSec=60s
  36.  
  37. [Install]
  38. WantedBy=multi-user.target
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement