@@ -159,12 +159,12 @@ smtp_setup() {
159159 local hostname=$( grep -E " ^myhostname[ ]?=[ ]?.*$" /etc/postfix/main.cf | cut -d " =" -f 2 -s | sed " s/ //" )
160160 [[ -n $hostname && -f /etc/nginx/sites-available/$hostname ]] && local default_host=" [$hostname ]"
161161
162- echo " ${gre } "
162+ echo " ${blu } "
163163 echo " **********************************"
164- echo " ********** SMTP Setup **********"
164+ echo " ********** ${bol} SMTP Setup${end}${blu} **********"
165165 echo " **********************************"
166166 echo " "
167- echo " * We only support TLS and Port 587."
167+ echo " ${dim} * We only support TLS and Port 587.${end} "
168168 echo " "
169169 read -p " ${blu} + SMTP Host: ${end} " host
170170 read -p " ${blu} + User: ${end} " user
@@ -589,6 +589,7 @@ server_reset() {
589589
590590
591591show_db_data () {
592+ check_for_mysql
592593 if [[ -n $( conf_read external-dbu) && -n $( conf_read external-dbp) ]]; then
593594 local extu=$( conf_read external-dbu)
594595 local extp=$( conf_read external-dbp)
@@ -604,17 +605,17 @@ show_db_data() {
604605 [[ -n $( conf_read mysql-root) ]] && local rpass=$( echo $( conf_read mysql-root) | openssl enc -d -a -salt ) || local rpass=" Not-Available!"
605606 [[ -n $( conf_read mysql-admin) ]] && local apass=$( echo $( conf_read mysql-admin) | openssl enc -d -a -salt ) || local apass=" Not-Available!"
606607 echo " "
607- echo " ${gre} Localhost Credentials${end} "
608- echo " ${blu}${bol} root:${end}${blu}${dim} $rpass ${end} "
609- echo " ${blu}${bol} admin:${end}${blu}${dim} $apass ${end} "
608+ echo " ${blu}${bol} Localhost Credentials: ${end} "
609+ echo " ${blu} root:${end}${blu}${dim} $rpass ${end} "
610+ echo " ${blu} admin:${end}${blu}${dim} $apass ${end} "
610611 echo " "
611612
612613 if [[ -n $extu ]]; then
613614 echo " "
614- echo " ${gre} External DB Credentials${end} "
615+ echo " ${blu}${bol} External DB Credentials: ${end} "
615616 [[ -n $exth ]] && echo " ${blu}${bol} Host:${end}${blu}${dim} $exth ${end} "
616- echo " ${blu}${bol} User:${end}${blu}${dim} $extu ${end} "
617- echo " ${blu}${bol} Password:${end}${blu}${dim} $extp ${end} "
617+ echo " ${blu} User:${end}${blu}${dim} $extu ${end} "
618+ echo " ${blu} Password:${end}${blu}${dim} $extp ${end} "
618619 echo " "
619620 fi
620621
@@ -755,7 +756,7 @@ set_tools_site() {
755756 if [[ $force_www =~ ^(www| root)$ ]]; then
756757 sudo site galaboral.com -force-redirect=off > /dev/null 2>&1
757758 sudo site galaboral.com -force-redirect=$force_www > /dev/null 2>&1
758- echo " ${gre}${dim} Force-Redirect '${force_www} ' settings updated!${end} "
759+ echo " ${gre}${dim} Force-Redirect ${blu} '${force_www} '${gre} settings updated!${end} "
759760 fi
760761
761762 echo " ${gre} Domain${blu} ${tools_site} :$( conf_read tools-port) ${gre} was successfully assigned to access your server tools!${end} "
@@ -818,9 +819,9 @@ set_tools_site() {
818819
819820www_data_sftp_access () {
820821 if [[ $sftp == " on" && $( conf_read login-www-data) == " true" ]]; then
821- echo " ${gre} SFTP access for www-data user is already enabled! ${end} "
822+ echo " ${gre} SFTP access for ${blu} ' www-data' ${gre} user is already enabled! ${end} "
822823 elif [[ $sftp == " off" && $( conf_read login-www-data) != " true" ]]; then
823- echo " ${gre} SFTP access for www-data user is already disabled! ${end} "
824+ echo " ${gre} SFTP access for ${blu} ' www-data' ${gre} user is already disabled! ${end} "
824825 elif [[ $sftp == " on" ]]; then
825826 # Remove if empty! (prevent empty files with spaces taken as valid)
826827 if [[ -f /var/www/.ssh/authorized_keys && ( ! -s /var/www/.ssh/authorized_keys || -z $( cat -v /var/www/.ssh/authorized_keys | grep -m 1 ' [^[:space:]]' ) ) ]]; then
@@ -860,7 +861,7 @@ Match Group sftponly
860861 conf_write login-www-data true
861862 conf_write sftp-www-data true
862863 sudo systemctl restart ssh
863- echo " ${gre} SFTP access for www-data user has been successfuly enabled! ${end} "
864+ echo " ${gre} SFTP access for ${blu} ' www-data' ${gre} user has been successfuly enabled! ${end} "
864865
865866 elif [[ $sftp == " off" ]]; then
866867 sudo gpasswd -d www-data sftponly > /dev/null 2>&1
@@ -884,9 +885,9 @@ Match Group sftponly
884885 conf_write login-www-data false
885886 conf_write sftp-www-data false
886887 sudo systemctl restart ssh
887- echo " ${gre} SFTP access for www-data user has been successfuly disabled! ${end} "
888+ echo " ${gre} SFTP access for ${blu} ' www-data' ${gre} user has been successfuly disabled! ${end} "
888889 else
889- echo " ${red} [ERROR] Invalid value for login-www-data ! ${end} "
890+ echo " ${red} [ERROR] Invalid value for SFTP ! ${end} "
890891 exit 1
891892 fi
892893}
@@ -954,16 +955,17 @@ external_sources_update() {
954955
955956
956957clear_caches () {
957- if [[ $clear_cache =~ ^(redis| all)$ ]]; then
958+ if [[ ${ clear_cache,,} =~ ^(redis| all)$ ]]; then
958959 if [[ $( conf_read php-tool-redis) == " true" && -f /etc/redis/redis.conf ]]; then
959960 sudo redis-cli flushall
960961 echo " ${gre} - Redis Cache has been successfully cleared!${end} "
961962 else
962- [[ $clear_cache != " all" ]] && echo " ${red} [ERROR] We can not clear Redis Cache because is not installed!${end} "
963+ [[ ${clear_cache,,} != " all" ]] && echo " ${red} [ERROR] We can not clear Redis Cache because is not installed!${end} "
964+ [[ ${clear_cache,,} == " all" ]] && echo " ${dim} [INFO] Redis not installed!${end} "
963965 err_cont=true
964966 fi
965967 fi
966- if [[ $clear_cache =~ ^(memcache| memcached| all)$ ]]; then
968+ if [[ ${ clear_cache,,} =~ ^(memcache| memcached| all)$ ]]; then
967969 if [[ $( conf_read php-tool-memcached) == " true" && -f /etc/memcached.conf ]]; then
968970 local memhost=$( grep ^-l /etc/memcached.conf | cut -f 2 -d ' ' | head -1)
969971 local memport=$( grep ^-p /etc/memcached.conf | cut -f 2 -d ' ' | head -1)
@@ -973,11 +975,12 @@ clear_caches() {
973975 echo " ${red} - Memcached connection failed! ${dim} (/dev/tcp/$memhost /$memport )${end} "
974976 fi
975977 else
976- [[ $clear_cache != " all" ]] && echo " ${red} [ERROR] We can not clear Memcache because is not installed!${end} "
978+ [[ ${clear_cache,,} != " all" ]] && echo " ${red} [ERROR] We can not clear Memcache because is not installed!${end} "
979+ [[ ${clear_cache,,} == " all" ]] && echo " ${dim} [INFO] Memcache not installed!${end} "
977980 err_cont=true
978981 fi
979982 fi
980- if [[ $clear_cache =~ ^(opcache| all)$ ]]; then
983+ if [[ ${ clear_cache,,} =~ ^(opcache| all)$ ]]; then
981984 if [[ $( conf_read nginx) == " true" && $( conf_read php) == " true" ]]; then
982985 if [[ ! -f /var/www/$ADMIN_TOOLS_SITE /htdocs/php/opcache/index.php ]]; then
983986 sudo mkdir /var/www/$ADMIN_TOOLS_SITE /htdocs/php/opcache
@@ -989,16 +992,18 @@ clear_caches() {
989992 wget --spider --no-check-certificate --timeout=15 -t 1 localhost:$( conf_read tools-port) /php/opcache/ > /dev/null 2>&1 &
990993 echo " ${gre} - OpCache has been successfully cleared!${end} "
991994 else
992- [[ $clear_cache != " all" ]] && echo " ${red} [ERROR] We can not clear OpCache because PHP or NGINX are not installed!${end} "
995+ [[ ${clear_cache,,} != " all" ]] && echo " ${red} [ERROR] We can not clear OpCache because PHP or NGINX are not installed!${end} "
996+ [[ ${clear_cache,,} == " all" ]] && echo " ${dim} [INFO] OpCache not installed!${end} "
993997 err_cont=true
994998 fi
995999 fi
996- if [[ $clear_cache =~ ^(fastcgi| all)$ ]]; then
1000+ if [[ ${ clear_cache,,} =~ ^(fastcgi| all)$ ]]; then
9971001 if [[ $( conf_read nginx) == " true" ]]; then
9981002 sudo rm -Rf /run/nginx-cache/*
9991003 echo " ${gre} - FastCgi Cache has been successfully cleared!${end} "
10001004 else
1001- [[ $clear_cache != " all" ]] && echo " ${red} [ERROR] We can not clear FastCGI Cache because NGINX is not installed!${end} "
1005+ [[ ${clear_cache,,} != " all" ]] && echo " ${red} [ERROR] We can not clear FastCGI Cache because NGINX is not installed!${end} "
1006+ [[ ${clear_cache,,} == " all" ]] && echo " ${dim} [INFO] FastCGI not installed!${end} "
10021007 err_cont=true
10031008 fi
10041009 fi
@@ -1078,7 +1083,7 @@ nginx_blockip() {
10781083 echo " deny $blockip ;" >> /etc/nginx/conf.d/blockips.conf
10791084 echo " ${gre} The IP address ${blu} '$blockip '${gre} was successfully blocked!${end} "
10801085 else
1081- echo " ${gre} IP '$blockip ' is already blocked!${end} "
1086+ echo " ${gre} IP ${blu} '$blockip '${gre} is already blocked!${end} "
10821087 fi
10831088 else
10841089 echo " ${red} [ERROR] Please, enter a valid IP value!${end} "
@@ -1120,8 +1125,8 @@ nginx_blockip() {
11201125
11211126set_default_nginx_response () {
11221127 if [[ $default_site == true ]]; then
1123- echo " ${gre} Please, enter a valid option to set the Default-Site server response! ${end} "
1124- read -p " ${blu} default/ blackhole or any existing domain: ${end} " default_site
1128+ echo " ${blu}${bol} Please, enter a valid option to set the Default-Site server response. ${end} "
1129+ read -p " ${blu} * default, blackhole or example.com (valid domain)? ${end} " default_site
11251130 default_site=${default_site:- NeverMatchDotCom}
11261131 fi
11271132
@@ -1230,6 +1235,7 @@ aws_secret_access_key = $pass" >> $HOME/.aws/credentials
12301235
12311236
12321237database_import () {
1238+ check_for_mysql
12331239 [[ -z $file ]] && read -p " ${blu} SQL file path to import: ${end} " file
12341240 if [[ -z $file || ! -f $file ]]; then
12351241 echo " ${red} [ERROR] Please, enter a valid file path!${end} "
0 commit comments