From acb068de4fd2cd37a8a0ac406f8a0eeed4fd5380 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Fri, 30 Oct 2020 13:34:57 +0100 Subject: Move Minecraft config to separate branch --- minecraft | 31 +++++++++++++++++++++++++++++++ minecraft/install | 14 -------------- minecraft/minecraft | 31 ------------------------------- 3 files changed, 31 insertions(+), 45 deletions(-) create mode 100644 minecraft delete mode 100644 minecraft/install delete mode 100644 minecraft/minecraft (limited to 'minecraft') diff --git a/minecraft b/minecraft new file mode 100644 index 0000000..33e31dc --- /dev/null +++ b/minecraft @@ -0,0 +1,31 @@ +#!/sbin/openrc-run + +name=minecraft +description='Minecraft server' + +MCPATH=/srv/minecraft +JAR=$MCPATH/paper.server.jar +CMD="java -Xmx1G -Xms1G -jar $JAR nogui" +SESSION=minecraft + +depend() { + use net +} + +start() { + echo Starting Minecraft server... + (cd $MCPATH && screen -h 1024 -dmS $SESSION $CMD) +} + +stop() { + if pgrep -f "$JAR" > /dev/null + then + screen -p 0 -S $SESSION -X eval 'stuff "stop"\015' + echo Waiting for Minecraft server to shut down... + while pgrep -f "$JAR" > /dev/null + do + sleep 0.2 + done + fi + echo Minecraft server is shut down. +} diff --git a/minecraft/install b/minecraft/install deleted file mode 100644 index 07e9c94..0000000 --- a/minecraft/install +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh - -# install the latest build of Paper for Minecraft VERSION into MCPATH - -VERSION=1.16.3 -MCPATH=/srv/minecraft - -apk add openjdk8-jre ncurses -apk add screen # needed only if you use the OpenRC script - -mkdir -p "$MCPATH" -cd "$MCPATH" -build=`curl -s "https://papermc.io/api/v1/paper/$VERSION" | sed 's/.*"latest":"\([0-9]*\)".*/\1/'` -curl -o paper.server.jar "https://papermc.io/api/v1/paper/$VERSION/$build/download" \ No newline at end of file diff --git a/minecraft/minecraft b/minecraft/minecraft deleted file mode 100644 index 33e31dc..0000000 --- a/minecraft/minecraft +++ /dev/null @@ -1,31 +0,0 @@ -#!/sbin/openrc-run - -name=minecraft -description='Minecraft server' - -MCPATH=/srv/minecraft -JAR=$MCPATH/paper.server.jar -CMD="java -Xmx1G -Xms1G -jar $JAR nogui" -SESSION=minecraft - -depend() { - use net -} - -start() { - echo Starting Minecraft server... - (cd $MCPATH && screen -h 1024 -dmS $SESSION $CMD) -} - -stop() { - if pgrep -f "$JAR" > /dev/null - then - screen -p 0 -S $SESSION -X eval 'stuff "stop"\015' - echo Waiting for Minecraft server to shut down... - while pgrep -f "$JAR" > /dev/null - do - sleep 0.2 - done - fi - echo Minecraft server is shut down. -} -- cgit v1.2.3