| Server IP : 104.129.129.72 / Your IP : 216.73.216.229 Web Server : LiteSpeed System : Linux 123answers 5.15.0-143-generic #153-Ubuntu SMP Fri Jun 13 19:10:45 UTC 2025 x86_64 User : answe8064 ( 1002) PHP Version : 8.2.28 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /opt/installer/apps/ |
Upload File : |
#!/bin/bash
if [ -f "include/startup.sh" ]; then
. include/startup.sh
elif [ -f "../include/startup.sh" ]; then
. ../include/startup.sh
fi
appPath=/opt/minecraft/survival
echo "Creating directory and installing dependencies" | log
mkdir -p $appPath
ubuntu_version=$(lsb_release -rs)
if [[ "$ubuntu_version" == "24.04" ]]; then
installPackage openjdk-17-jre-headless screen default-jdk nmap | log
waitOrStop 0 "Failed to install dependencies"
else
installPackage openjdk-16-jre-headless screen default-jdk nmap | log
waitOrStop 0 "Failed to install dependencies"
fi
echo "Creating MineCraft User" | log
useradd -m -r -d /opt/minecraft minecraft
echo "Downloading server Jar file" | log
cd $appPath
curlDownload https://launcher.mojang.com/v1/objects/a16d67e5807f57fc4e550299cf20226194497dc2/server.jar
waitOrStop 0 "File not downloaded from official source"
echo "eula=true" > /opt/minecraft/survival/eula.txt
chown -R minecraft /opt/minecraft/survival/
echo "Creating MineCraft Service" | log
cat << EOF > /etc/systemd/system/minecraft@.service
[Unit]
Description=Minecraft Server: %i
After=network.target
[Service]
WorkingDirectory=/opt/minecraft/%i
User=minecraft
Group=minecraft
Restart=always
ExecStart=/usr/bin/screen -DmS mc-%i /usr/bin/java -Xmx2G -jar server.jar nogui
ExecStop=/usr/bin/screen -p 0 -S mc-%i -X eval 'stuff "say SERVER SHUTTING DOWN IN 5 SECONDS. SAVING ALL MAPS..."\015'
ExecStop=/bin/sleep 5
ExecStop=/usr/bin/screen -p 0 -S mc-%i -X eval 'stuff "save-all"\015'
ExecStop=/usr/bin/screen -p 0 -S mc-%i -X eval 'stuff "stop"\015'
[Install]
WantedBy=multi-user.target
EOF
echo "Adding FW rules"
ufw allow 25565
echo "Enabling MineCraft Service" | log
systemctl start minecraft@survival
sleep 3
waitOrStop 0 "Failed to start MineCraft service"
systemctl enable minecraft@survival
sleep 3
sed -i "s/server-ip=/server-ip=${CWM_SERVERIP}/g" ${appPath}/server.properties
systemctl restart minecraft@survival
echo "Adding descriptions" | log
descriptionAppend "MineCraft Server Directory: ${appPath}"
descriptionAppend "MineCraft Server Configuration file: ${appPath}/server.properties"
descriptionAppend "MineCraft Server Port: 25565"
descriptionAppend " "
descriptionAppend "To connect to your server go to the game client and connect to: ${CWM_SERVERIP}:25565"
descriptionAppend " "
tagScript success
exit 0