diff --git a/bin/v-get-database-credentials-of-site b/bin/v-get-database-credentials-of-domain similarity index 79% rename from bin/v-get-database-credentials-of-site rename to bin/v-get-database-credentials-of-domain index 9375f023c..0082dc9ce 100644 --- a/bin/v-get-database-credentials-of-site +++ b/bin/v-get-database-credentials-of-domain @@ -1,5 +1,33 @@ #!/bin/bash +# info: get database credentials of domain and other basic data +# options: DOMAIN [SUBFOLDER] +# +# The function get database credentials of domain and other basic data. + + +#----------------------------------------------------------# +# Check necessary parameters # +#----------------------------------------------------------# + +if [ $# -lt 1 ]; then + echo "USAGE: v-get-database-credentials-of-site DOMAIN [SUBFOLDER]" + exit 1 +fi + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + + +# Argument definition +DOMAIN=$1 +domain=$1 +SUBFOLDER='' +if [ $# -gt 1 ]; then + SUBFOLDER=$2 +fi + # Importing system environment source /etc/profile @@ -7,16 +35,9 @@ source /etc/profile source /usr/local/vesta/func/main.sh -if [ $# -lt 1 ]; then - echo "USAGE: v-get-database-credentials-of-site DOMAIN [SUBFOLDER]" - exit 1 -fi - -DOMAIN=$1 -SUBFOLDER='' -if [ $# -gt 1 ]; then - SUBFOLDER=$2 -fi +#----------------------------------------------------------# +# Verifications # +#----------------------------------------------------------# USER=$(/usr/local/vesta/bin/v-search-domain-owner "$DOMAIN") if [ -z "$USER" ]; then @@ -24,6 +45,10 @@ if [ -z "$USER" ]; then exit 2 fi +#----------------------------------------------------------# +# Action # +#----------------------------------------------------------# + SITE_FOLDER="/home/$USER/web/$DOMAIN/public_html" CHECK_PUBLIC_SHTML=$(/usr/local/vesta/bin/v-list-web-domain "$USER" "$DOMAIN" | grep 'SSL:' | grep -c 'single') if [ $CHECK_PUBLIC_SHTML -eq 1 ]; then