|
@ -1,25 +1,6 @@ |
|
|
#!/bin/bash |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Make Variables Available For Later Use |
|
|
|
|
|
LOGDIR=/var/log/easyengine |
|
|
|
|
|
MAINLOG=/var/log/easyengine/main.log |
|
|
|
|
|
ERRORLOG=/var/log/easyengine/error.log |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Capture Errors |
|
|
|
|
|
OwnError() |
|
|
|
|
|
{ |
|
|
|
|
|
echo -e "[ `date` ] \033[31m $@ \e[0m" | tee -ai $ERRORLOG |
|
|
|
|
|
exit 101 |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Help Function |
|
|
# Help Function |
|
|
EngineHelp() |
|
|
EngineHelp() |
|
|
{ |
|
|
{ |
|
@ -46,10 +27,24 @@ EngineHelp() |
|
|
echo " 0 if OK," |
|
|
echo " 0 if OK," |
|
|
echo " 100 sudo privilege required," |
|
|
echo " 100 sudo privilege required," |
|
|
echo " 101 command failed to execute," |
|
|
echo " 101 command failed to execute," |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Make Variables Available For Later Use |
|
|
|
|
|
LOGDIR=/var/log/easyengine |
|
|
|
|
|
MAINLOG=/var/log/easyengine/main.log |
|
|
|
|
|
ERRORLOG=/var/log/easyengine/error.log |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Capture Errors |
|
|
|
|
|
OwnError() |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
echo -e "[ `date` ] \033[31m $@ \e[0m" | tee -ai $ERRORLOG |
|
|
|
|
|
exit 101 |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# GET Information Function |
|
|
# GET Information Function |
|
@ -99,7 +94,6 @@ WEBUSERINFO() |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
NGINXRELOAD() |
|
|
NGINXRELOAD() |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
@ -110,8 +104,6 @@ NGINXRELOAD() |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PHPSTART() |
|
|
PHPSTART() |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
@ -127,15 +119,20 @@ PHPSTART() |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Easy Engine System Settings |
|
|
# Easy Engine System Settings |
|
|
if [ "$1" = "system" ] |
|
|
if [ "$1" = "system" ] |
|
|
then |
|
|
then |
|
|
|
|
|
|
|
|
# Easy Engine Install |
|
|
# Easy Engine Install |
|
|
if [ "$2" = "install" ] |
|
|
if [ "$2" = "install" ] |
|
|
then |
|
|
then |
|
|
|
|
|
|
|
|
if [ "$3" = "nginx" ] |
|
|
if [ "$3" = "nginx" ] |
|
|
then |
|
|
then |
|
|
|
|
|
|
|
|
# Install Python Software Properties |
|
|
# Install Python Software Properties |
|
|
echo -e "\033[34m Installing Python Software Properties... \e[0m" |
|
|
echo -e "\033[34m Installing Python Software Properties... \e[0m" |
|
|
sudo apt-get -y install python-software-properties \ |
|
|
sudo apt-get -y install python-software-properties \ |
|
@ -239,6 +236,7 @@ then |
|
|
|
|
|
|
|
|
if [ "$3" = "nginx" ] |
|
|
if [ "$3" = "nginx" ] |
|
|
then |
|
|
then |
|
|
|
|
|
|
|
|
# Remove Nginx |
|
|
# Remove Nginx |
|
|
echo -e "\033[34m Removing Nginx... \e[0m" |
|
|
echo -e "\033[34m Removing Nginx... \e[0m" |
|
|
sudo apt-get -y remove nginx || OwnError "Unable To Remove Nginx" |
|
|
sudo apt-get -y remove nginx || OwnError "Unable To Remove Nginx" |
|
@ -288,6 +286,7 @@ then |
|
|
|
|
|
|
|
|
if [ "$3" = "nginx" ] |
|
|
if [ "$3" = "nginx" ] |
|
|
then |
|
|
then |
|
|
|
|
|
|
|
|
# Purge Nginx |
|
|
# Purge Nginx |
|
|
echo -e "\033[34m Purge Nginx... \e[0m" |
|
|
echo -e "\033[34m Purge Nginx... \e[0m" |
|
|
sudo apt-get -y remove --purge nginx || OwnError "Unable To Purge Nginx" |
|
|
sudo apt-get -y remove --purge nginx || OwnError "Unable To Purge Nginx" |
|
@ -343,12 +342,14 @@ then |
|
|
# Easy Engine Site Settings |
|
|
# Easy Engine Site Settings |
|
|
elif [ "$1" = "site" ] |
|
|
elif [ "$1" = "site" ] |
|
|
then |
|
|
then |
|
|
|
|
|
|
|
|
# Easy Engine Read |
|
|
# Easy Engine Read |
|
|
if [ "$2" = "read" ] |
|
|
if [ "$2" = "read" ] |
|
|
then |
|
|
then |
|
|
|
|
|
|
|
|
if [ "$3" = "all" ] |
|
|
if [ "$3" = "all" ] |
|
|
then |
|
|
then |
|
|
|
|
|
|
|
|
# Display The List Of All Sites |
|
|
# Display The List Of All Sites |
|
|
echo -e "\033[34m List Of All (sites-available) Websites \e[0m" |
|
|
echo -e "\033[34m List Of All (sites-available) Websites \e[0m" |
|
|
ls /etc/nginx/sites-available/ \ |
|
|
ls /etc/nginx/sites-available/ \ |
|
@ -356,6 +357,7 @@ then |
|
|
|
|
|
|
|
|
elif [ "$3" = "active" ] |
|
|
elif [ "$3" = "active" ] |
|
|
then |
|
|
then |
|
|
|
|
|
|
|
|
# Display The List Of Active Sites |
|
|
# Display The List Of Active Sites |
|
|
echo -e "\033[34m List Of Active (sites-enabled) Websites \e[0m" |
|
|
echo -e "\033[34m List Of Active (sites-enabled) Websites \e[0m" |
|
|
ls /etc/nginx/sites-enabled/ \ |
|
|
ls /etc/nginx/sites-enabled/ \ |
|
@ -418,6 +420,7 @@ then |
|
|
|
|
|
|
|
|
if [ "$4" = "--with-wordpress" ] |
|
|
if [ "$4" = "--with-wordpress" ] |
|
|
then |
|
|
then |
|
|
|
|
|
|
|
|
# Download Latest Wordpress |
|
|
# Download Latest Wordpress |
|
|
echo -e "\033[34m Downloading WordPress \e[0m" |
|
|
echo -e "\033[34m Downloading WordPress \e[0m" |
|
|
wget -cO /var/www/$DOMAIN/htdocs/latest.tar.gz \ |
|
|
wget -cO /var/www/$DOMAIN/htdocs/latest.tar.gz \ |
|
@ -469,12 +472,11 @@ then |
|
|
# Start PHP-FPM If Not Running |
|
|
# Start PHP-FPM If Not Running |
|
|
PHPSTART |
|
|
PHPSTART |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
else |
|
|
else |
|
|
EngineHelp |
|
|
EngineHelp |
|
|
|
|
|
|
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Easy Engine Update |
|
|
# Easy Engine Update |
|
|
elif [ "$2" = "update" ] |
|
|
elif [ "$2" = "update" ] |
|
|
then |
|
|
then |
|
@ -485,7 +487,6 @@ then |
|
|
# Remove http:// & www. |
|
|
# Remove http:// & www. |
|
|
DOMAIN=$(echo $3 | sed "s'http://''" | sed "s'www.''") |
|
|
DOMAIN=$(echo $3 | sed "s'http://''" | sed "s'www.''") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if [ "$4" = "single" ] |
|
|
if [ "$4" = "single" ] |
|
|
then |
|
|
then |
|
|
|
|
|
|
|
@ -541,29 +542,32 @@ then |
|
|
NGINXRELOAD |
|
|
NGINXRELOAD |
|
|
|
|
|
|
|
|
else |
|
|
else |
|
|
EngineHelp |
|
|
EngineHelp |
|
|
|
|
|
|
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
|
#elif [ "$4" = "multi" ] |
|
|
|
|
|
#then |
|
|
|
|
|
|
|
|
|
|
|
#else |
|
|
elif [ "$4" = "multi" ] |
|
|
# EngineHelp |
|
|
then |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
else |
|
|
|
|
|
EngineHelp |
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
|
else |
|
|
|
|
|
EnginHelp |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
else |
|
|
|
|
|
EngineHelp |
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Easy Engine Delete |
|
|
# Easy Engine Delete |
|
|
elif [ "$2" = "delete" ] |
|
|
elif [ "$2" = "delete" ] |
|
|
then |
|
|
then |
|
|
|
|
|
|
|
|
if [ -n "$3" ] |
|
|
if [ -n "$3" ] |
|
|
then |
|
|
then |
|
|
|
|
|
|
|
|
# Remove http:// & www. |
|
|
# Remove http:// & www. |
|
|
DOMAIN=$(echo $3 | sed "s'http://''" | sed "s'www.''") |
|
|
DOMAIN=$(echo $3 | sed "s'http://''" | sed "s'www.''") |
|
|
|
|
|
|
|
@ -629,16 +633,17 @@ then |
|
|
|
|
|
|
|
|
else |
|
|
else |
|
|
EnginHelp |
|
|
EnginHelp |
|
|
|
|
|
|
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Easy Engine Help |
|
|
# Easy Engine Help |
|
|
else |
|
|
else |
|
|
EngineHelp |
|
|
EngineHelp |
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#echo "Under Developments !!" |
|
|
|
|
|
|
|
|
|
|
|
# Easy Engine Config Settings |
|
|
# Easy Engine Config Settings |
|
|
elif [ "$1" = "config" ] |
|
|
elif [ "$1" = "config" ] |
|
|