blob: 2bec0d7100af859d12024ba32b697b9da40ffc4d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
#!/bin/sh
MCPATH=/srv/minecraft
SESSION=minecraft
JAR=paper.server.jar
CMD="java -Xmx1G -Xms1G -jar $JAR nogui"
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.
}
case "$1" in
start) start;;
stop) stop;;
# *) echo "Usage: $0 start|stop" 1>&2; exit 2;;
esac
|