KasuganoSoras
2019-08-19 00:03:01 +08:00
# vim /etc/systemd/system/minecraft.service
[Unit]
Description=Minecraft Server
Wants=network-online.target
After=network-online.target
[Service]
User=root
WorkingDirectory=/<服务端目录>/
LimitNOFILE=4096
PIDFile=/var/run/minecraft/server.pid
ExecStart=/usr/bin/java -Xmx 最大内存 M -Xms 最小内存 M -jar <jar 名字>
Restart=on-failure
StartLimitInterval=600
[Install]
WantedBy=multi-user.target
# systemctl daemon-reload
# systemctl enable minecraft --now
完事了