standard syntax for commands
Commands syntax updated: root, parked, toolsport, configcache with "=" and brackets "[ ]" .
This commit is contained in:
parent
ab31ea704d
commit
34d341341f
|
@ -8,9 +8,7 @@ source /opt/webinoly/lib/general
|
||||||
site_ssl_on() {
|
site_ssl_on() {
|
||||||
local cermail=$(conf_read mail)
|
local cermail=$(conf_read mail)
|
||||||
local root="$domain"
|
local root="$domain"
|
||||||
if [[ "$cache" == "-root" ]]; then
|
[[ $cache == "-root" && -n $value ]] && root="$value"
|
||||||
root="$domroot"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "${gre}"
|
echo "${gre}"
|
||||||
echo "*************************************************************************************************"
|
echo "*************************************************************************************************"
|
||||||
|
|
48
plugins/site
48
plugins/site
|
@ -11,7 +11,6 @@ shopt -s extglob
|
||||||
domain="$1"
|
domain="$1"
|
||||||
type="$2"
|
type="$2"
|
||||||
cache="$3"
|
cache="$3"
|
||||||
domroot="$4"
|
|
||||||
|
|
||||||
source /opt/webinoly/lib/general
|
source /opt/webinoly/lib/general
|
||||||
source /opt/webinoly/lib/sites
|
source /opt/webinoly/lib/sites
|
||||||
|
@ -38,20 +37,30 @@ else
|
||||||
subdomflag="1"
|
subdomflag="1"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
wp="0" # Evaluate if site to create is WP ( 0 = noWP, 1 = WP, 2 = WP with default values, 3 = WP with custom values )
|
# Extract value if exist
|
||||||
if [[ "$type" == "-wp" || "$type" == "-wpsubdir" || "$type" == "-wpsubdom" ]]; then
|
if [[ $type == "-parked="* || $type == "-proxy="* || $type == "-wp="* || $type == "-wpsubdir="* || $type == "-wpsubdom="* ]]; then
|
||||||
wp="1"
|
value=$(echo "${type}" | cut -d'=' -f 2 -s)
|
||||||
fi
|
|
||||||
if [[ "$type" == "-wp="* || "$type" == "-wpsubdir="* || "$type" == "-wpsubdom="* ]]; then
|
|
||||||
wpunat=$(echo "${type}" | cut -d'=' -f 2 -s)
|
|
||||||
if [[ $wpunat == "default" ]]; then
|
|
||||||
wp="2"
|
|
||||||
type=$(echo "${type}" | cut -d'=' -f 1 -s)
|
type=$(echo "${type}" | cut -d'=' -f 1 -s)
|
||||||
|
fi
|
||||||
|
if [[ $cache == "-root="* ]]; then
|
||||||
|
value=$(echo "${cache}" | cut -d'=' -f 2 -s)
|
||||||
|
cache=$(echo "${cache}" | cut -d'=' -f 1 -s)
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Evaluate if site to create is WP ( 0 = noWP, 1 = WP, 2 = WP with default values, 3 = WP with custom values )
|
||||||
|
wp="0"
|
||||||
|
if [[ $type == "-wp" || $type == "-wpsubdir" || $type == "-wpsubdom" ]]; then
|
||||||
|
wp="1"
|
||||||
|
|
||||||
|
if [[ -n $value ]]; then
|
||||||
|
if [[ $value == "default" ]]; then
|
||||||
|
wp="2"
|
||||||
else
|
else
|
||||||
# -wp=[setupmysql,setupwp,dbhost,dbname,dbuser,dbpass,dbpref,extdbuser,extdbpass]
|
# -wp=[setupmysql,setupwp,dbhost,dbname,dbuser,dbpass,dbpref,extdbuser,extdbpass]
|
||||||
custombegin=$(echo "${wpunat}" | cut -c-1)
|
custombegin=$(echo "${value}" | cut -c-1)
|
||||||
customlast=$(echo "${wpunat}" | rev | cut -c-1)
|
customlast=$(echo "${value}" | rev | cut -c-1)
|
||||||
wpdata=${wpunat:1:-1}
|
wpdata=${value:1:-1}
|
||||||
|
|
||||||
# Double coma is for lower case convertion
|
# Double coma is for lower case convertion
|
||||||
setmsqcustom=$(echo "${wpdata,,}" | cut -d',' -f 1 -s)
|
setmsqcustom=$(echo "${wpdata,,}" | cut -d',' -f 1 -s)
|
||||||
|
@ -67,7 +76,7 @@ if [[ "$type" == "-wp="* || "$type" == "-wpsubdir="* || "$type" == "-wpsubdom="*
|
||||||
|
|
||||||
if [[ $custombegin == "[" && $customlast == "]" && ((($setmsqcustom == "true" || $setpwpcustom == "true") && -n $dbhostcustom && -n $dbnamecustom && -n $dbusercustom && -n $dbpasscustom && -n $dbprefcustom) || ($setmsqcustom == "false" && $setpwpcustom == "false")) ]]; then
|
if [[ $custombegin == "[" && $customlast == "]" && ((($setmsqcustom == "true" || $setpwpcustom == "true") && -n $dbhostcustom && -n $dbnamecustom && -n $dbusercustom && -n $dbpasscustom && -n $dbprefcustom) || ($setmsqcustom == "false" && $setpwpcustom == "false")) ]]; then
|
||||||
wp="3"
|
wp="3"
|
||||||
type=$(echo "${type}" | cut -d'=' -f 1 -s)
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -168,9 +177,7 @@ elif [ "$type" == "-wpsubdom" ]; then
|
||||||
# Parked Domain
|
# Parked Domain
|
||||||
elif [ "$type" == "-parked" ]; then
|
elif [ "$type" == "-parked" ]; then
|
||||||
mapto="NeverMatchAtFirstDotCom"
|
mapto="NeverMatchAtFirstDotCom"
|
||||||
if [[ -n $cache ]]; then
|
[[ -n $value ]] && mapto="$value"
|
||||||
mapto="$cache"
|
|
||||||
fi
|
|
||||||
|
|
||||||
while [[ ! -a /etc/nginx/sites-available/$mapto ]]
|
while [[ ! -a /etc/nginx/sites-available/$mapto ]]
|
||||||
do
|
do
|
||||||
|
@ -198,16 +205,17 @@ elif [ "$type" == "-parked" ]; then
|
||||||
echo "${end}"
|
echo "${end}"
|
||||||
|
|
||||||
# Reverse proxy
|
# Reverse proxy
|
||||||
elif [[ "$type" == "-proxy" || "$type" == "-proxy="* ]]; then
|
elif [[ "$type" == "-proxy" ]]; then
|
||||||
createsite
|
createsite
|
||||||
sudo sed -i '/include /d' /etc/nginx/sites-available/$domain
|
sudo sed -i '/include /d' /etc/nginx/sites-available/$domain
|
||||||
sudo sed -i '/root /d' /etc/nginx/sites-available/$domain
|
sudo sed -i '/root /d' /etc/nginx/sites-available/$domain
|
||||||
sudo sed -i '/index /d' /etc/nginx/sites-available/$domain
|
sudo sed -i '/index /d' /etc/nginx/sites-available/$domain
|
||||||
sudo sed -i '/error_log /r /opt/webinoly/templates/template-site-proxy' /etc/nginx/sites-available/$domain
|
sudo sed -i '/error_log /r /opt/webinoly/templates/template-site-proxy' /etc/nginx/sites-available/$domain
|
||||||
|
|
||||||
rparg=$(echo "${type}" | cut -d'=' -f 2 -s)
|
if [[ -n $value ]]; then
|
||||||
rphost=$(echo "${rparg}" | cut -d':' -f 1 -s)
|
rphost=$(echo "${value}" | cut -d':' -f 1 -s)
|
||||||
rpport=$(echo "${rparg}" | cut -d':' -f 2 -s)
|
rpport=$(echo "${value}" | cut -d':' -f 2 -s)
|
||||||
|
fi
|
||||||
|
|
||||||
echo "${gre}"
|
echo "${gre}"
|
||||||
if [[ -n $rphost ]]; then
|
if [[ -n $rphost ]]; then
|
||||||
|
|
|
@ -9,6 +9,14 @@ arg="$2"
|
||||||
|
|
||||||
source /opt/webinoly/lib/install
|
source /opt/webinoly/lib/install
|
||||||
|
|
||||||
|
# Extract value if exist
|
||||||
|
if [[ $opt == "-tools-port="* || $opt == "-config-cache="* ]]; then
|
||||||
|
value=$(echo "${opt}" | cut -d'=' -f 2 -s)
|
||||||
|
opt=$(echo "${opt}" | cut -d'=' -f 1 -s)
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if [ "$opt" == "-update" ]; then
|
if [ "$opt" == "-update" ]; then
|
||||||
if [[ $arg == '-vbeta' ]]; then
|
if [[ $arg == '-vbeta' ]]; then
|
||||||
sudo wget --timeout=15 -qrO weby https://qrok.es/wyupdb && sudo bash weby -vbeta
|
sudo wget --timeout=15 -qrO weby https://qrok.es/wyupdb && sudo bash weby -vbeta
|
||||||
|
@ -53,7 +61,7 @@ elif [ "$opt" == "-dbpass" ]; then
|
||||||
elif [ "$opt" == "-tools-port" ]; then
|
elif [ "$opt" == "-tools-port" ]; then
|
||||||
if [[ $(conf_read nginx-tool) == "true" && $(conf_read nginx) == "true" ]]; then
|
if [[ $(conf_read nginx-tool) == "true" && $(conf_read nginx) == "true" ]]; then
|
||||||
oldport="$(conf_read tools-port)"
|
oldport="$(conf_read tools-port)"
|
||||||
tools_port $arg
|
[[ -n $value ]] && tools_port $value || tools_port
|
||||||
newport="$(conf_read tools-port)"
|
newport="$(conf_read tools-port)"
|
||||||
if [[ $oldport != $newport ]]; then
|
if [[ $oldport != $newport ]]; then
|
||||||
sudo mv /var/www/$oldport /var/www/$newport
|
sudo mv /var/www/$oldport /var/www/$newport
|
||||||
|
@ -149,7 +157,7 @@ elif [ "$opt" == "-config-cache" ]; then
|
||||||
othline=$( grep -F "fastcgi_cache_valid 301 302 307 404" /etc/nginx/conf.d/fastcgi.conf )
|
othline=$( grep -F "fastcgi_cache_valid 301 302 307 404" /etc/nginx/conf.d/fastcgi.conf )
|
||||||
othval=$(echo "${othline//;}" | rev | cut -d' ' -f 1 | rev)
|
othval=$(echo "${othline//;}" | rev | cut -d' ' -f 1 | rev)
|
||||||
|
|
||||||
if [[ -z $arg ]]; then
|
if [[ -z $value ]]; then
|
||||||
echo "${gre}"
|
echo "${gre}"
|
||||||
echo "**********************************************************************"
|
echo "**********************************************************************"
|
||||||
echo "************* Set FastCGI Cache new time values **************"
|
echo "************* Set FastCGI Cache new time values **************"
|
||||||
|
@ -168,9 +176,13 @@ elif [ "$opt" == "-config-cache" ]; then
|
||||||
read -p " Set new value: " oth
|
read -p " Set new value: " oth
|
||||||
oth=${oth:-$othval}
|
oth=${oth:-$othval}
|
||||||
else
|
else
|
||||||
hit=$(echo "${arg}" | cut -d',' -f 1 )
|
custombegin=$(echo "${value}" | cut -c-1)
|
||||||
ina=$(echo "${arg}" | cut -d',' -f 2 )
|
customlast=$(echo "${value}" | rev | cut -c-1)
|
||||||
oth=$(echo "${arg}" | cut -d',' -f 3 )
|
cachedata=${value:1:-1}
|
||||||
|
|
||||||
|
hit=$(echo "${cachedata}" | cut -d',' -f 1 )
|
||||||
|
ina=$(echo "${cachedata}" | cut -d',' -f 2 )
|
||||||
|
oth=$(echo "${cachedata}" | cut -d',' -f 3 )
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$hit" =~ ^[0-9]+[smhdwMy]$ && "$ina" =~ ^[0-9]+[smhdwMy]$ && "$oth" =~ ^[0-9]+[smhdwMy]$ ]]; then
|
if [[ "$hit" =~ ^[0-9]+[smhdwMy]$ && "$ina" =~ ^[0-9]+[smhdwMy]$ && "$oth" =~ ^[0-9]+[smhdwMy]$ ]]; then
|
||||||
|
|
Loading…
Reference in a new issue