Explorar el Código

system check for wildcard search

Serghey Rodin hace 10 años
padre
commit
bbd5befedd
Se han modificado 1 ficheros con 12 adiciones y 5 borrados
  1. 12 5
      func/domain.sh

+ 12 - 5
func/domain.sh

@@ -85,11 +85,10 @@ is_domain_new() {
     type="$1"
     type="$1"
     dom=${2-$domain}
     dom=${2-$domain}
 
 
-    web=$(grep -F -H "DOMAIN='$dom'" $VESTA/data/users/*/web.conf)
-    dns=$(grep -F -H "DOMAIN='$dom'" $VESTA/data/users/*/dns.conf)
-    mail=$(grep -F -H "DOMAIN='$dom'" $VESTA/data/users/*/mail.conf)
-
     # Check web domain
     # Check web domain
+    if [ ! -z "$WEB_SYSTEM" ]; then
+        web=$(grep -F -H "DOMAIN='$dom'" $VESTA/data/users/*/web.conf)
+    fi
     if [ ! -z "$web" ] && [ "$type" == 'web' ]; then
     if [ ! -z "$web" ] && [ "$type" == 'web' ]; then
         echo "Error: domain $dom exist"
         echo "Error: domain $dom exist"
         log_event "$E_EXISTS" "$EVENT"
         log_event "$E_EXISTS" "$EVENT"
@@ -105,6 +104,9 @@ is_domain_new() {
     fi
     fi
 
 
     # Check dns domain
     # Check dns domain
+    if [ ! -z "$DNS_SYSTEM" ]; then
+        dns=$(grep -F -H "DOMAIN='$dom'" $VESTA/data/users/*/dns.conf)
+    fi
     if [ ! -z "$dns" ] && [ "$type" == 'dns' ]; then
     if [ ! -z "$dns" ] && [ "$type" == 'dns' ]; then
         echo "Error: domain $dom exist"
         echo "Error: domain $dom exist"
         log_event "$E_EXISTS" "$EVENT"
         log_event "$E_EXISTS" "$EVENT"
@@ -120,6 +122,9 @@ is_domain_new() {
     fi
     fi
 
 
     # Check mail domain
     # Check mail domain
+    if [ ! -z "$MAIL_SYSTEM" ]; then
+        mail=$(grep -F -H "DOMAIN='$dom'" $VESTA/data/users/*/mail.conf)
+    fi
     if [ ! -z "$mail" ] && [ "$type" == 'mail' ]; then
     if [ ! -z "$mail" ] && [ "$type" == 'mail' ]; then
         echo "Error: domain $dom exist"
         echo "Error: domain $dom exist"
         log_event "$E_EXISTS" "$EVENT"
         log_event "$E_EXISTS" "$EVENT"
@@ -135,7 +140,9 @@ is_domain_new() {
     fi
     fi
 
 
     # Check web aliases
     # Check web aliases
-    web_alias=$(grep -w $dom $VESTA/data/users/*/web.conf)
+    if [ ! -z "$WEB_SYSTEM" ]; then
+        web_alias=$(grep -w $dom $VESTA/data/users/*/web.conf)
+    fi
     if [ ! -z "$web_alias" ]; then
     if [ ! -z "$web_alias" ]; then
         c1=$(grep -H "'$dom'" $VESTA/data/users/*/web.conf | cut -f 7 -d /)
         c1=$(grep -H "'$dom'" $VESTA/data/users/*/web.conf | cut -f 7 -d /)
         c2=$(grep -H "'$dom," $VESTA/data/users/*/web.conf | cut -f 7 -d /)
         c2=$(grep -H "'$dom," $VESTA/data/users/*/web.conf | cut -f 7 -d /)