Advertisement
Guest User

Untitled

a guest
Dec 24th, 2017
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.82 KB | None | 0 0
  1. [Unit]
  2. Description=Minecraft Server %i
  3. After=network.target
  4.  
  5. [Service]
  6. WorkingDirectory=/opt/minecraft/%i
  7. PrivateUsers=true # Users Database is not available for within the unit, only root and minecraft is available, everybody else is nobody
  8. User=natalka
  9. ProtectSystem=full # Read only mapping of /usr /boot and /etc
  10. ProtectHome=true # /home, /root and /run/user seam to be empty from within the unit. It is recommended to enable this setting for all long-running services (in particular network-facing ones).
  11. ProtectKernelTunables=true # /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.
  12. # Implies MountFlags=slave
  13. ProtectKernelModules=true # 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
  14. # Implies NoNewPrivileges=yes
  15. ProtectControlGroups=true # It is hence recommended to turn this on for most services.
  16. # Implies MountAPIVFS=yes
  17.  
  18. ExecStart=/bin/sh -c '/usr/bin/screen -DmS mc-%i /usr/bin/java -server -Xms512M -Xmx4096M -XX:+UseG1GC -XX:+CMSIncrementalPacing -XX:+CMSClassUnloadingEnabled -XX:ParallelGCThreads=2 -XX:MinHeapFreeRatio=5 -XX:MaxHeapFreeRatio=10 -jar $(ls -v | grep -i "FTBServer.*jar\|minecraft_server.*jar" | head -n 1) nogui'
  19.  
  20. ExecReload=/usr/bin/screen -p 0 -S mc-%i -X eval 'stuff "reload"\\015'
  21.  
  22. ExecStop=/usr/bin/screen -p 0 -S mc-%i -X eval 'stuff "say SERVER SHUTTING DOWN. Saving map..."\\015'
  23. ExecStop=/usr/bin/screen -p 0 -S mc-%i -X eval 'stuff "save-all"\\015'
  24. ExecStop=/usr/bin/screen -p 0 -S mc-%i -X eval 'stuff "stop"\\015'
  25. ExecStop=/bin/sleep 10
  26.  
  27. Restart=on-failure
  28. RestartSec=60s
  29.  
  30. [Install]
  31. WantedBy=multi-user.target
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement