diff --git a/minecraft/minecraft.service b/minecraft/minecraft.service new file mode 100644 index 0000000..8c10930 --- /dev/null +++ b/minecraft/minecraft.service @@ -0,0 +1,25 @@ +[Unit] +Description=Minecraft Server + +[Service] + +Type=forking + +User=minecraft +Group=minecraft +WorkingDirectory=/opt/minecraft + +ExecStartPre=/opt/minecraft/scripts/rdify --init /opt/minecraft/world +ExecStart=/opt/minecraft/scripts/minecraft/mineserve start +ExecStartPost=screen -S mine_world_sync -dm /opt/minecraft/scripts/rdify --loop_sync 15 /opt/minecraft/world + +ExecStop=screen -S mine_world_sync -X stuff "" +ExecStop=/opt/minecraft/scripts/minecraft/mineserve stop +ExecStopPost=/opt/minecraft/scripts/rdify --sync /opt/minecraft/world +ExecStopPost=/opt/minecraft/scripts/rdify --cleanup /opt/minecraft/world + +Restart=on-failure +RestartSec=30 + +[Install] +WantedBy=multi-user.target diff --git a/mineserve b/minecraft/mineserve similarity index 100% rename from mineserve rename to minecraft/mineserve