#!/bin/bash

# See: https://git.io/JMIKH

# Server JAR file, set this to your own
FILE=server.jar

# Trap SIGTERM, forward it to server process ID
trap 'kill -TERM $PID' TERM INT

# Start server
java -Xms1G -Xmx1G -jar $FILE --nogui &

# Remember server process ID, wait for it to quit, then reset the trap
PID=$!
wait $PID
trap - TERM INT
wait $PID
