Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [Unit]
- Description=Minecraft Server %i
- After=network.target
- [Service]
- WorkingDirectory=/opt/minecraft/mc_servers/%i
- # Solves the issue where the minecraft server will endlessly restart itself
- # See https://askubuntu.com/questions/953920/systemctl-service-timed-out-during-start for more info
- Type=simple
- PrivateUsers=true
- # Users Database is not available from within the unit, only root and minecraft is available, everybody else is nobody
- User=minecraft
- Group=minecraft
- ProtectSystem=full
- # Read only mapping of /usr /boot and /etc
- ProtectHome=true
- # /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).
- 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.
- # Implies MountFlags=slave
- 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
- # Implies NoNewPrivileges=yes
- ProtectControlGroups=true
- # It is hence recommended to turn this on for most services.
- # Implies MountAPIVFS=yes
- # Set default memory values
- #Environment="MCMINMEM=512M" "MCMAXMEM=1024M"
- #Enviroment="SHUTDOWN_DELAY=5" "POST_SHUTDOWN_DELAY=10"
- # Change memory values in environment file
- #EnvironmentFile=-/opt/minecraft/%i/server.conf
- # Uncomment this to fix screen on RHEL 8
- #ExecStartPre=+/bin/sh -c 'chmod 777 /run/screen'
- #ExecStart=/bin/sh -c '/opt/minecraft/mc_servers/server_controll/start_server %i'
- #ExecStop=/opt/minecraft/mc_servers/server_controll/stop_server %i
- Restart=on-failure
- RestartSec=60s
- [Install]
- WantedBy=multi-user.target
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement