Skip to content

Instantly share code, notes, and snippets.

@mihionmc
Last active November 30, 2021 15:38
Show Gist options
  • Save mihionmc/f327325f6dadf4df0439ed5e174c5ee0 to your computer and use it in GitHub Desktop.
Save mihionmc/f327325f6dadf4df0439ed5e174c5ee0 to your computer and use it in GitHub Desktop.
#!/bin/sh
# mihion.dk automatical Minecraft plugin update v.1.0.3.
# a shell script used to download several specific plugins, extract the archived files, move them to a specific directory.
# remove unwanted files, delete the old plugins in several server coppy the new pluginst to the respective directories.
# clean all the downloaded files and run serverl server updates scripts wich stopse the servere and update the minecraft server.
#Dir variebles
DIR1=/home/zen/pluginsupdate/
DIR2=/home/zen/pluginsupdate/files/
DIR3=/home/zen/pluginsupdate/jar/
DIR4=/home/zen/srv/
DIR5=/home/zen/pluginsupdate/bungeejar/
# wget log files variebles
LOG1=get1.log LOG2=get2.log LOG3=get3.log
# wget download plugz url's variebles
URL1=https://ci.ender.zone/job/EssentialsX/lastSuccessfulBuild/artifact/*zip*/archive.zip
URL2=https://ci.lucko.me/view/LuckPerms/job/LuckPerms//lastSuccessfulBuild/artifact/*zip*/archive.zip
URL3=http://coreprotect.net/download/CoreProtect-2.18.2.jar
#starting
cd $DIR2
echo Download and organization starts
# Download, change name and extract
wget --content-disposition -O essentials.zip $URL1 -o $LOG1 && unzip -qq essentials.zip
wget --content-disposition -O luck.zip $URL2 -o $LOG2 && unzip -qq luck.zip
#wget $URL3 -o $LOG3
cp get1.log $DIR1
cp get2.log $DIR1
#fetch all .jar move them to jar folder & delete unnecessary files in files folder
cd $DIR1
find . -type f -name "*.jar" -exec mv {} jar \;
find . -type f \( -name "EssentialsXA*" -o -name "EssentialsXG*" -o -name "EssentialsXP*" -o -name "EssentialsXX*" -o -name "LuckPerms-N*" -o -name "LuckPerms-V*" -o -name "LuckPerms-S*" -o -name "LuckPerms-Bukkit-L*" \) -exec rm -f {} \;
#Deleting old Luck-Bungee in bungeejar/ before mowing new in directory
cd $DIR5
find . -type f -name "LuckPerms-Bungee*" -exec rm -f {} \;
# copy lukperms bungee.jar out of jar7 to bungeejar/ :)
cd $DIR3
find . -type f -name "LuckPerms-Bungee*" -exec mv {} /home/zen/pluginsupdate/bungeejar/ \;
#clean all downloaded files
cd $DIR2 && rm -rf *
# Searche and destroy plugins in server directories...
cd $DIR4
find . -type f \( -name "Essentials*" -o -name "LuckPerms*" \) -exec rm -f {} \;
find . -type d -name "plugins" -exec cp /home/zen/pluginsupdate/jar/* {} \;
#-o -name "CoreProtect*"
# ..empty jar..
cd $DIR3 && rm -f *
#Starting update script - server wil reboot...
echo "Running the server update script..."
cd $DIR4
sh vanillamc/update.sh
sh mcmmo/update.sh
sh hardcoremc/update.sh
sh creative/update.sh
echo "The server is now updated and will start soon"
#Scp LuckPerms-Bungee to the bungee srv
cd $DIR5
scp * [email protected]:/srv/waterfall/plugins/
#Restrart the Bungeecord server...
ssh [email protected] /etc/init.d/waterfall stop
#done
#remember remember th. 10th of feb...2020? Do not run rm * befor trying with echo first...
#find . -type f -name "Essentials*" -exec echo {} \;
#Not currently, you can use http://update.coreprotect.net/version/ though, and pull via http://coreprotect.net/download/CoreProtect-2.18.2.jar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment