This is a script I use to run my minecraft server on a Linux distribution. The advantage of using this shell script is that it passes the necessary Java arguments to optimize the server based on the machine's resources. First make sure that the jar file's name is: "minecraft_server.jar". To change the RAM setting:
-Xmx"A"G -Xms"A"G
Replace "A" with the correct number of dedicated GB. To change the Cores setting:
-XX:ParallelGCThreads="B"
Replace "B" with the correct number of dedicated cores.