Compare commits

..

No commits in common. "33b9bbc76f53467918f3b72206fd5ebe41281d07" and "6ccf4dd9c628410cdf8189aa1aa0d975596f1126" have entirely different histories.

3 changed files with 37 additions and 30 deletions

View File

@ -8,7 +8,15 @@ WantedBy=multi-user.target
[Service] [Service]
ExecReload=/usr/bin/screen -S minecraft -X stuff \"reload^M\" ExecReload=/usr/bin/screen -S minecraft -X stuff \"reload^M\"
ExecStart=/usr/bin/screen -DmS minecraft ./start.sh ExecStart=/usr/bin/screen -DmS minecraft ./run.sh
#ExecStartPre=/bin/sh -c '/usr/bin/screen -dmS mc-perfect'
#ExecStart=/bin/sh -c '/opt/minecraft/run.sh'
#ExecStop=/usr/bin/screen -S minecraft -X stuff \"save-all^M\"
#ExecStop=/bin/sleep 5
#ExecStop=/usr/bin/screen -S minecraft -X stuff \"stop^M\"
#ExecStop=/bin/sleep 5
ExecStop=/usr/bin/screen -p 0 -S minecraft -X eval 'stuff "say SERVER SHUTTING DOWN. Saving map..."\\015' ExecStop=/usr/bin/screen -p 0 -S minecraft -X eval 'stuff "say SERVER SHUTTING DOWN. Saving map..."\\015'
ExecStop=/bin/sh -c '/bin/sleep 5' ExecStop=/bin/sh -c '/bin/sleep 5'
@ -16,8 +24,8 @@ ExecStop=/usr/bin/screen -p 0 -S minecraft -X eval 'stuff "save-all"\\015'
ExecStop=/usr/bin/screen -p 0 -S minecraft -X eval 'stuff "stop"\\015' ExecStop=/usr/bin/screen -p 0 -S minecraft -X eval 'stuff "stop"\\015'
ExecStop=/bin/sh -c '/bin/sleep 10' ExecStop=/bin/sh -c '/bin/sleep 10'
Restart=on-failure #Restart=on-failure
RestartSec=60s #RestartSec=60s
ProtectControlGroups=true ProtectControlGroups=true
ProtectHome=true ProtectHome=true

9
data/user_jvm_args.txt Normal file
View File

@ -0,0 +1,9 @@
# Xmx and Xms set the maximum and minimum RAM usage, respectively.
# They can take any number, followed by an M or a G.
# M means Megabyte, G means Gigabyte.
# For example, to set the maximum to 3GB: -Xmx3G
# To set the minimum to 2.5GB: -Xms2500M
# A good default for a modded server is 4GB.
# Uncomment the next line to set it.
# -Xmx4G

View File

@ -13,7 +13,7 @@ if [[ "$ansFirewallSetup" =~ ("N"|"n") ]]; then
printf "+ Thanks, working on next bit\n" printf "+ Thanks, working on next bit\n"
elif [[ "$ansFirewallSetup" =~ ("Y"|"y") || -z $ansFirewallSetup ]]; then else
printf "Do you want to block non-LAN ssh connections? [Y/n/castom]: " printf "Do you want to block non-LAN ssh connections? [Y/n/castom]: "
read sshBlockRange read sshBlockRange
@ -58,17 +58,10 @@ sudo apt upgrade -y
# Installing depandencies # Installing depandencies
printf "\n+ Installing depandencies \n\n" printf "\n+ Installing depandencies \n\n"
sudo apt install openjdk-21-jre-headless screen -y sudo apt install openjdk-17-jre-headless screen p7zip-full iptables -y
if [[ "$ansFirewallSetup" =~ ("y"|"Y") || -z $ansFirewallSetup ]]; then
sudo apt install iptables -y
fi
# User and groupe managment # User and groupe managment
printf "\n+ Creating user minecraft and basic file structure" printf "\n+ Creating user minecraft and basic file structure"
groupadd minecraft groupadd minecraft
useradd --system --shell /usr/sbin/nologin --home /opt/minecraft -g minecraft minecraft useradd --system --shell /usr/sbin/nologin --home /opt/minecraft -g minecraft minecraft
@ -76,30 +69,28 @@ useradd --system --shell /usr/sbin/nologin --home /opt/minecraft -g minecraft mi
# File strukture and basic install # File strukture and basic install
mkdir /opt/minecraft mkdir /opt/minecraft
mv data/paper-1.20.6-148.jar /opt/minecraft/ mv data/Forge-1.20.1.jar /opt/minecraft/
cd /opt/minecraft/ cd /opt/minecraft/
# Installing server # Installing server
printf "+ Installing Paper 1.20.6 \n \n" printf "+ Installing Forge 1.20.1 \n \n"
java -Xms512M -Xmx2048M -jar paper-1.20.6-148.jar --nogui java -Xms512M -Xmx2048M -jar Forge-1.20.1.jar --installServer
cd - cd -
cd data/ cd data/
mv eula.txt server-icon.png server.properties user_jvm_args.txt /opt/minecraft/ mv eula.txt server-icon.png server.properties run.sh user_jvm_args.txt /opt/minecraft/
cd .. cd ..
### Addons support??? mkdir /opt/minecraft/mods
# mkdir /opt/minecraft/mods printf "\n+ Unpacking mods \n \n"
# printf "\n+ Unpacking mods \n \n" cd data
7z x Mods.zip -o/opt/minecraft/mods/
# cd data cd ..
# 7z x Mods.zip -o/opt/minecraft/mods/
# cd ..
# Permision handeling # Permision handeling
printf "\n+ Permision handeling\n" printf "\n+ Permision handeling\n"
@ -107,11 +98,11 @@ chown -R minecraft:minecraft /opt/minecraft
# SystemD service # SystemD service
printf "+ Preparign systemD service\n" printf "+ Preparign systemD service\n"
mv data/mc-paper.service /etc/systemd/system/ mv data/mc-forge.service /etc/systemd/system/
systemctl daemon-reload systemctl daemon-reload
systemctl start mc-paper systemctl start mc-forge.service
systemctl enable mc-paper systemctl enable mc-forge
# integration of Maxopoly's instructions on firewall # integration of Maxopoly's instructions on firewall
@ -143,16 +134,15 @@ if [[ "$ansFirewallSetup" =~ ("Y"|"y") || -z "$ansFirewallSetup" ]]; then
iptables -P OUTPUT ACCEPT #Allow all outgouing iptables -P OUTPUT ACCEPT #Allow all outgouing
sudo apt install iptables-persistent -y
else else
printf "\nOK it is time for manual configuration" printf "\nOK it is time for manual configuration"
printf "\nAfter you are done ramamber to run 'apt install iptables-persistent' to save your config. System will automaticly remove your work after restart \n \n" printf "\nAfter you are done ramamber to run 'apt install iptables-persistent' to save your config. System will automaticly remove your work after restart"
fi fi
apt install iptables-persistent -y
fi fi
printf "\n+ Done, thanks for your time. It is goode idea to chack if everythink is alright by running:" printf "\n+ Done, thanks for your time. It is goode idea to chack if everythink is alright by running:"