Fixed a few things that didn't work well

This commit is contained in:
Henry Corse
2022-12-12 20:47:49 -05:00
parent 17bb4b9997
commit d384b81d59
2 changed files with 5 additions and 8 deletions

View File

@ -13,25 +13,23 @@ status() {
tail -n +$LAST_STATUS logs/latest.log
echo
}
serve() {
java -Xms1G -Xmx5G -jar server.jar nogui
}
start() {
if test -f "$PID"; then
echo "Server already running with pid: $(cat $PID)"
status
exit 0
fi
fi
screen -S minecraft -dm java -Xms1G -Xmx5G -jar server.jar nogui
pgrep -P "$(screen -list | sed -E -n 's/\s*([0-9]+).minecraft.*/\1/p')" > $PID
}
stop() {
if test -f "$PID"; then
SCREEN_PID=$(screen -list | sed -E -n 's/\s*([0-9]+).minecraft.*/\1/p')
screen -S minecraft -X stuff "stop
"
"
echo -n "Waiting for shutdown..."
# kill -0 checks if a process is running
while kill -0 $SCREEN_PID 2> /dev/null; do
sleep 3