Update and rename v-get-database-credentials-of-site to v-get-database-credentials-of-domain

This commit is contained in:
myvesta 2020-07-12 22:09:54 +02:00 committed by GitHub
commit 4a12408981
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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