LCKB
Automatic server installer for ubuntu servers - Printable Version

+- LCKB (https://lckb.dev/forum)
+-- Forum: ** OLD LCKB DATABASE ** (https://lckb.dev/forum/forumdisplay.php?fid=109)
+--- Forum: Release Zone (https://lckb.dev/forum/forumdisplay.php?fid=190)
+---- Forum: Episode 3 Releases (https://lckb.dev/forum/forumdisplay.php?fid=172)
+----- Forum: Server Side (https://lckb.dev/forum/forumdisplay.php?fid=139)
+------ Forum: Archived Server Side (https://lckb.dev/forum/forumdisplay.php?fid=117)
+------ Thread: Automatic server installer for ubuntu servers (/showthread.php?tid=4201)

Pages: 1 2 3


- Kekers - 11-27-2014


I definitely have no reason to move or do anything to my script or server. Who cares. Because I dont

Like I said before nub moderation. You should care because all this script is going to do is continue executing even after it throw an error. I'm not sure why you're echo'n the return value either as well.

 

Here's an example of the proper way of writing a shell script (when you update yours throw me some credits).

#!/bin/bash

printf "\nProper LastChaos EP3 Setup Shell Script By Warmonger\n\n"
sleep 3

##################################################
# Check For Previous Installations
##################################################

if [ -d "lastchaos" ]; then
while true; do
read -p "Previous Files Found, Delete Them? " yn
case $yn in
[Yy]* ) rm -r lastchaos; sleep 1; break;;
[Nn]* ) exit;;
* ) echo "Please Answer Yes Or No";;
esac
done
fi

##################################################
# Create The Directory For Server Files
##################################################

printf "Creating LastChaos Directory..."
mkdir lastchaos >/dev/null 2>&1
if [ "$?" = "0" ]; then
printf " DONE!\n"
sleep 1
else
printf " ERROR!\n\n"
exit
fi

##################################################
# Navigate Into Directory
##################################################

printf "Navigate Into LastChaos Directory..."
cd lastchaos >/dev/null 2>&1
if [ "$?" = "0" ]; then
printf " DONE!\n"
sleep 1
else
printf " ERROR!\n\n"
exit
fi

##################################################
# Download Server Files
##################################################

printf "Downloading Server Files..."
wget -t 1 --timeout=10 http://www.lcdownloads.com/garbage/EP3.zip >/dev/null 2>&1
if [ "$?" = "0" ]; then
printf " DONE!\n"
sleep 1
else
printf " ERROR!\n\n"
exit
fi

##################################################
# Extract Server Files
##################################################

printf "Extracting Server Files..."
unzip EP3.zip >/dev/null 2>&1
if [ "$?" = "0" ]; then
printf " DONE!\n"
sleep 1
else
printf " ERROR!\n\n"
exit
fi

##################################################
# CHMOD Server Files
##################################################

printf "CHMOD Connector..."
chmod +x lastchaos/EP3/Connector/Connector >/dev/null 2>&1
if [ "$?" = "0" ]; then
printf " DONE!\n"
sleep 1
else
printf " ERROR!\n\n"
exit
fi

printf "CHMOD GameServer..."
chmod +x lastchaos/EP3/GameServer1/GameServer1/GameServer_d >/dev/null 2>&1
if [ "$?" = "0" ]; then
printf " DONE!\n"
sleep 1
else
printf " ERROR!\n\n"
exit
fi

printf "CHMOD Helper..."
chmod +x lastchaos/EP3/Helper/Helper/Helper >/dev/null 2>&1
if [ "$?" = "0" ]; then
printf " DONE!\n"
sleep 1
else
printf " ERROR!\n\n"
exit
fi

printf "CHMOD LoginServer..."
chmod +x lastchaos/EP3/LoginServer/LoginServer/LoginServer >/dev/null 2>&1
if [ "$?" = "0" ]; then
printf " DONE!\n"
sleep 1
else
printf " ERROR!\n\n"
exit
fi

printf "CHMOD Messenger..."
chmod +x lastchaos/EP3/Messenger/Messenger/Messenger >/dev/null 2>&1
if [ "$?" = "0" ]; then
printf " DONE!\n"
sleep 1
else
printf " ERROR!\n\n"
exit
fi

printf "CHMOD SubHelper..."
chmod +x lastchaos/EP3/SubHelper/SubHelper >/dev/null 2>&1
if [ "$?" = "0" ]; then
printf " DONE!\n\n"
sleep 1
else
printf " ERROR!\n\n"
exit
fi

##################################################
# Install MySQL Server
##################################################

printf "Installing MySQL Server..."
apt-get -y install mysql-server >/dev/null 2>&1
if [ "$?" = "0" ]; then
printf " DONE!\n\n"
sleep 1
else
printf " ERROR!\n\n"
exit
fi

##################################################
# Configure MySQL Server
##################################################

printf "Configuring MySQL Server..."
update-rc.d mysql defaults >/dev/null 2>&1
if [ "$?" = "0" ]; then
printf " DONE!\n\n"
sleep 1
else
printf " ERROR!\n\n"
exit
fi

##################################################
# Download Databases
##################################################

printf "Downloading Databases..."
wget -t 1 --timeout=10 http://www.lcdownloads.com/garbage/cleandb.zip >/dev/null 2>&1
if [ "$?" = "0" ]; then
printf " DONE!\n\n"
sleep 1
else
printf " ERROR!\n\n"
exit
fi

##################################################
# Extract Databases
##################################################

printf "Extracting Databases..."
unzip cleandb.zip >/dev/null 2>&1
if [ "$?" = "0" ]; then
printf " DONE!\n\n"
sleep 1
else
printf " ERROR!\n\n"
exit
fi

##################################################
# Create And Restore Databases
##################################################

printf "Creating And Restoring Databases..."
mysql -e "CREATE DATABASE newproject_data;"
if [ "$?" = "0" ]; then
mysql -v newproject_data < clean_newproject_data_ep3.sql
if [ "$?" = "0" ]; then
mysql -e "CREATE DATABASE newproject_db;"
if [ "$?" = "0" ]; then
mysql -v newproject_db < clean_newproject_db_ep3.sql
if [ "$?" = "0" ]; then
mysql -e "CREATE DATABASE newproject_db_auth;"
if [ "$?" = "0" ]; then
mysql -v newproject_db_auth < clean_newproject_db_auth_ep3.sql
if [ "$?" = "0" ]; then
mysql -e "CREATE DATABASE newproject_db_post;"
if [ "$?" = "0" ]; then
mysql -v newproject_db_post < clean_newproject_post_ep3.sql
if [ "$?" = "0" ]; then
mysql -e "CREATE DATABASE newproject_db_user;"
if [ "$?" = "0" ]; then
mysql -v newproject_db_user < clean_newproject_db_user_ep3.sql
if [ "$?" = "0" ]; then
printf " DONE!\n\n"
sleep 1
else
printf " ERROR!\n\n"
exit
fi
else
printf " ERROR!\n\n"
exit
fi
else
printf " ERROR!\n\n"
exit
fi
else
printf " ERROR!\n\n"
exit
fi
else
printf " ERROR!\n\n"
exit
fi
else
printf " ERROR!\n\n"
exit
fi
else
printf " ERROR!\n\n"
exit
fi
else
printf " ERROR!\n\n"
exit
fi
else
printf " ERROR!\n\n"
exit
fi
else
printf " ERROR!\n\n"
exit
fi

printf "\nScript Finished!\n\n"
exit



- pwesty - 11-27-2014

Just never learns, stop hijacking my thread.




- Kekers - 11-28-2014


Just never learns stops teaching, stop hijacking contributing to my thread.

If you're going to do something at least do it right the first time. It's a good philosophy to go by.




- Walletman987 - 11-28-2014


If you're going to do something at least do it right the first time. It's a good philosophy to go by.

THE QUEEN HAS SPOKEN!  ALL HAIL QUEEN WARMONGER.  ALL HAIL THE QUEEN!




- Arnii - 11-28-2014



THE QUEEN HAS SPOKEN!  ALL HAIL QUEEN WARMONGER.  ALL HAIL THE QUEEN!

And one more useless post for nothing by Walletman987 Congratulations!  atleast if u post something, make it usefull --"




- Wizatek - 11-28-2014


Its all nice and all, but if you need a install script to get your server going then this whole private server thing isn't for you in the first place.

 




- Kekers - 11-28-2014


Its all nice and all, but if you need a install script to get your server going then this whole private server thing isn't for you in the first place.

It takes away from the fun of even setting up the server as well. I would agree if you need an automated shell script to set it up for you then you'll never have a successful server to begin with. How do these people expect to maintain their servers if they don't get the hands on bash experience required for managing a server.

 

I think this is Pwesty's scope of experience, a noobie trying to help other noobies.




- Walletman987 - 11-28-2014



It takes away from the fun of even setting up the server as well. I would agree if you need an automated shell script to set it up for you then you'll never have a successful server to begin with. How do these people expect to maintain their servers if they don't get the hands on bash experience required for managing a server.

 

I think this is Pwesty's scope of experience, a noobie trying to help other noobies.

I agree with you on that atleast.  But either way this makes things faster.




- Kekers - 11-28-2014


I agree with you on that atleast.  But either way this makes things faster.

Still no excuse for it to be written so simplistic (point I've been trying to get across). Once something fails it's only going to continue carrying out its duties which will only result in more errors the second time it has to be ran (prior configurations). There should be more logic involved with a script such as this. Including checking if a task has been completed prior to the task actually being executed (to avoid problems entirely).