Merge pull request #1 from jiriks74/devel

Add Aikar's flags, better comments, etc
This commit is contained in:
Jiří Štefka 2023-02-23 02:56:15 +01:00 committed by GitHub
commit 1dd0d40218
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 42 additions and 31 deletions

View file

@ -31,21 +31,13 @@ version="1.12.2"
5. Select how much memory you want your server to use ***(in megabytes)***: 5. Select how much memory you want your server to use ***(in megabytes)***:
```bash ```bash
initMem="1500M" #1.5G mem="8000M"
maxMem="8000M" # 12G
``` ```
6. Modify server parameters to your liking: 6. Allow executing ov the script with `chmod +x start.sh`
```bash 7. Run the script with `./start.sh`
mc_launchoptions="-nogui"
```
7. Add some jvm (java) parameters to your liking ***(memory is set above, do not add it here)***: ## Default JVM flags used
```bash
java_launchoptions=""
```
> **Note**
>
> If you use quite old versions of minecraft you should change the defaults under the line above
8. Run the script with `./start.sh` By default this script uses [Aikar's Flags](https://docs.papermc.io/paper/aikars-flags). It's set up so that it automatically modifies them if over
12GB of memory is set for the server so you shouldn't need to change them unless you want to swap them out for something else.

View file

@ -4,6 +4,7 @@
# by jiriks74 # # by jiriks74 #
# https://github.com/jiriks74/start_papermc.sh # # https://github.com/jiriks74/start_papermc.sh #
# This script is under GPLv3, if you want to distribute changes you have to do so under the same license # # This script is under GPLv3, if you want to distribute changes you have to do so under the same license #
# and acknowledge the original script and author. #
############################################################################################################# #############################################################################################################
############ ############
@ -16,32 +17,50 @@
# and change the version below. # # and change the version below. #
# I am not responsible for any loss of data # # I am not responsible for any loss of data #
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! # # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! #
# If enough people request it (or someone creates a PR) I'll add this functionality # If enough people request it (or someone creates a PR) I'll add the functionality to migrate versions
version="1.19.3" version="1.19.3"
# Leave blank to use the latest build # Leave blank to use the latest build (auto updates on every run)
select_build="" select_build=""
#
# Memory settings # Memory settings
initMem="2000M" # Minimum memory used #
maxMem="6000M" # Maximum memory allowed to be used # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! #
# Do not allocate all of your available memory on a shared host! #
# Minecraft (and Java) needs to have more memory than the Xmx #
# parameter (maxMem below). You should set it at least 1500M #
# lower than your available memory if you're running just the #
# minecraft server. #
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! #
mem="2000M"
# ------------------------------------------------
# You shouldn't need to change anything below this
# ------------------------------------------------
# Options for the server # Options for the server
mc_launchoptions="-nogui" mc_launchoptions="-nogui"
# G1GC settings - leave the defaults if you're unsure if [[ "${mem%M}" -gt 12000 ]]; then
g1HeapMem="32M" # Memory used by G1 G1NewSize=40
g1NewSize="20" # In % G1MaxNewSize=50
g1Reserve"20" # In % G1HeapRegionSize=16M
umaxGCpause="50" # In millis G1Reserve=15
InitiatingHeapOccupancy=20
else
G1NewSize=30
G1MaxNewSize=40
G1HeapRegionSize=8M
G1Reserve=20
InitiatingHeapOccupancy=15
fi
# Aditional options for the java runtime # Aikar's flags are used by default
java_launchoptions="" # See https://docs.papermc.io/paper/aikars-flags
java_launchoptions="-Xms$mem -Xmx$mem -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=$G1NewSize -XX:G1MaxNewSizePercent=$G1MaxNewSize -XX:G1HeapRegionSize=$G1HeapRegionSize -XX:G1ReservePercent=$G1Reserve -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=$InitiatingHeapOccupancy -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1 -Dusing.aikars.flags=https://mcflags.emc.gs -Daikars.new.flags=true"
# Change the defaults if you use older version of minecraft or just want to use something else
java_launchoptions="-Xms$initMem -Xmx$maxMem -XX:G1HeapRegionSize=$g1HeapMem -XX:+UseG1GC -XX:G1NewSizePercent=$g1NewSize -XX:G1ReservePercent=$g1Reserve -XX:MaxGCPauseMillis=$maxGCpause $java_launchoptions"
# You shouldn't need to change anything below this line
# -----------------------------------------------------
# Api url # Api url
url="https://api.papermc.io/v2/projects/paper/versions/$version/builds" url="https://api.papermc.io/v2/projects/paper/versions/$version/builds"