ferdinland-server-config/server-properties/start.sh
2025-03-04 21:27:14 -06:00

36 lines
1.5 KiB
Bash
Executable File

#!/usr/bin/env bash
fileName="fabric-1.21.1.jar"
memory=8192
configPath="./config"
serverConfigDir="server-properties"
packwizPath="https://files.ferdin.land/ferdinland/modpacks/server/smp/"
# Install git if it's not installed
export git=$(which git)
if [ -z $git ]
then
echo installing git...
echo | sudo -S apt install git
else
echo git is already installed
fi
# Update config directory
(cd "$configPath" && git pull)
# Copy server-properties
echo copying server.properties...
cp --force "$configPath"/"$serverConfigDir"/server.properties ./server.properties
# Copy server-icon.png
echo copying server-icon.png...
cp --force "$configPath"/"$serverConfigDir"/server.properties ./server-icon.png
#
echo installing mods from "$packwizPath"/pack.toml...
java -jar packwiz-installer-bootstrap.jar -g -s server "$packwizPath"/pack.toml
declare -i memory
java -Xms"$memory"M -Xmx"$memory"M -XX:+UnlockExperimentalVMOptions -XX:+UnlockDiagnosticVMOptions -XX:+AlwaysActAsServerClassMachine -XX:+AlwaysPreTouch -XX:+DisableExplicitGC -XX:+UseNUMA -XX:NmethodSweepActivity=1 -XX:ReservedCodeCacheSize=400M -XX:NonNMethodCodeHeapSize=12M -XX:ProfiledCodeHeapSize=194M -XX:NonProfiledCodeHeapSize=194M -XX:-DontCompileHugeMethods -XX:MaxNodeLimit=240000 -XX:NodeLimitFudgeFactor=8000 -XX:+UseVectorCmov -XX:+PerfDisableSharedMem -XX:+UseFastUnorderedTimeStamps -XX:+UseCriticalJavaThreadPriority -XX:ThreadPriorityPolicy=1 -XX:AllocatePrefetchStyle=3 -XX:+UseZGC -XX:AllocatePrefetchStyle=1 -XX:-ZProactive -jar "$fileName" --nogui