diff --git a/bin/v-add-remote-dns-domain b/bin/v-add-remote-dns-domain index b82ea4fd..2240bafd 100755 --- a/bin/v-add-remote-dns-domain +++ b/bin/v-add-remote-dns-domain @@ -14,6 +14,7 @@ user=$1 domain=$2 flush=$3 + # Includes source $VESTA/func/main.sh source $VESTA/func/remote.sh @@ -27,12 +28,7 @@ source $VESTA/conf/vesta.conf check_args '2' "$#" 'USER DOMAIN [FLUSH]' is_format_valid 'user' 'domain' is_system_enabled "$DNS_CLUSTER" 'DNS_CLUSTER' -if [ ! -e "$VESTA/conf/dns-cluster.conf" ]; then - check_result $E_NOTEXIST "dns-cluster.conf doesn't exist" -fi -if [ "$(ps auxf |grep -v grep |grep $BIN/$SCRIPT |wc -l)" -gt 2 ]; then - check_result $E_EXISTS "another sync process already running" -fi +is_procces_running remote_dns_health_check diff --git a/bin/v-add-remote-dns-record b/bin/v-add-remote-dns-record index 000f2948..91f4b727 100755 --- a/bin/v-add-remote-dns-record +++ b/bin/v-add-remote-dns-record @@ -29,12 +29,7 @@ is_format_valid 'user' 'domain' 'id' is_system_enabled "$DNS_CLUSTER" 'DNS_CLUSTER' is_object_valid 'user' 'USER' "$user" is_object_valid 'dns' 'DOMAIN' "$domain" -if [ ! -e "$VESTA/conf/dns-cluster.conf" ]; then - check_result $E_NOTEXIST "dns-cluster.conf doesn't exist" -fi -if [ "$(ps auxf |grep -v grep |grep $BIN/$SCRIPT |wc -l)" -gt 2 ]; then - check_result $E_EXISTS "another sync process already running" -fi +is_procces_running remote_dns_health_check diff --git a/bin/v-add-web-domain-proxy b/bin/v-add-web-domain-proxy index 37326352..ff6a12fa 100755 --- a/bin/v-add-web-domain-proxy +++ b/bin/v-add-web-domain-proxy @@ -12,8 +12,7 @@ # Argument definition user=$1 -domain=$(idn -t --quiet -u "$2" ) -domain_idn=$(idn -t --quiet -a "$domain") +domain=$2 template=$3 default_extentions="jpg,jpeg,gif,png,ico,svg,css,zip,tgz,gz,rar,bz2,doc,xls,\ exe,pdf,ppt,txt,odt,ods,odp,odf,tar,wav,bmp,rtf,js,mp3,avi,mpeg,flv,html,htm" @@ -51,6 +50,7 @@ is_proxy_template_valid $template # Defining domain parameters get_domain_values 'web' +prepare_web_domain_values local_ip=$(get_real_ip $IP) # Preparing domain values for the template substitution diff --git a/bin/v-change-remote-dns-domain-exp b/bin/v-change-remote-dns-domain-exp index 421e1408..0bb4685d 100755 --- a/bin/v-change-remote-dns-domain-exp +++ b/bin/v-change-remote-dns-domain-exp @@ -28,12 +28,7 @@ is_format_valid 'user' 'domain' is_system_enabled "$DNS_CLUSTER" 'DNS_CLUSTER' is_object_valid 'user' 'USER' "$user" is_object_valid 'dns' 'DOMAIN' "$domain" -if [ ! -e "$VESTA/conf/dns-cluster.conf" ]; then - check_result $E_NOTEXIST "dns-cluster.conf doesn't exist" -fi -if [ "$(ps auxf |grep -v grep |grep $BIN/$SCRIPT |wc -l)" -gt 2 ]; then - check_result $E_EXISTS "another sync process already running" -fi +is_procces_running remote_dns_health_check diff --git a/bin/v-change-remote-dns-domain-soa b/bin/v-change-remote-dns-domain-soa index 0974e1aa..c522b431 100755 --- a/bin/v-change-remote-dns-domain-soa +++ b/bin/v-change-remote-dns-domain-soa @@ -28,12 +28,7 @@ is_format_valid 'user' 'domain' is_system_enabled "$DNS_CLUSTER" 'DNS_CLUSTER' is_object_valid 'user' 'USER' "$user" is_object_valid 'dns' 'DOMAIN' "$domain" -if [ ! -e "$VESTA/conf/dns-cluster.conf" ]; then - check_result 1 $E_NOTEXIST "dns-cluster.conf doesn't exist" -fi -if [ "$(ps auxf |grep -v grep |grep $VESTA/bin/$SCRIPT |wc -l)" -gt 2 ]; then - check_result 1 $E_EXISTS "another sync process already running" -fi +is_procces_running remote_dns_health_check diff --git a/bin/v-change-remote-dns-domain-ttl b/bin/v-change-remote-dns-domain-ttl index 6bdc90e8..77bc235f 100755 --- a/bin/v-change-remote-dns-domain-ttl +++ b/bin/v-change-remote-dns-domain-ttl @@ -28,12 +28,7 @@ is_format_valid 'user' 'domain' is_system_enabled "$DNS_CLUSTER" 'DNS_CLUSTER' is_object_valid 'user' 'USER' "$user" is_object_valid 'dns' 'DOMAIN' "$domain" -if [ ! -e "$VESTA/conf/dns-cluster.conf" ]; then - check_result $E_NOTEXIST "dns-cluster.conf doesn't exist" -fi -if [ "$(ps auxf |grep -v grep |grep $BIN/$SCRIPT |wc -l)" -gt 2 ]; then - check_result $E_EXISTS "another sync process already running" -fi +is_procces_running remote_dns_health_check diff --git a/bin/v-delete-remote-dns-domain b/bin/v-delete-remote-dns-domain index 5200030e..bd8f46dd 100755 --- a/bin/v-delete-remote-dns-domain +++ b/bin/v-delete-remote-dns-domain @@ -26,12 +26,7 @@ source $VESTA/conf/vesta.conf check_args '2' "$#" 'USER DOMAIN' is_format_valid 'user' 'domain' is_system_enabled "$DNS_CLUSTER" 'DNS_CLUSTER' -if [ ! -e "$VESTA/conf/dns-cluster.conf" ]; then - check_result $E_NOTEXIST "dns-cluster.conf doesn't exist" -fi -if [ "$(ps auxf |grep -v grep |grep $BIN/$SCRIPT |wc -l)" -gt 2 ]; then - check_result $E_EXISTS "another sync process already running" -fi +is_procces_running remote_dns_health_check diff --git a/bin/v-delete-remote-dns-domains b/bin/v-delete-remote-dns-domains index 1902e576..3c3b8fd3 100755 --- a/bin/v-delete-remote-dns-domains +++ b/bin/v-delete-remote-dns-domains @@ -22,12 +22,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# is_system_enabled "$DNS_CLUSTER" 'DNS_CLUSTER' -if [ ! -e "$VESTA/conf/dns-cluster.conf" ]; then - check_result $E_NOTEXIST "dns-cluster.conf doesn't exist" -fi -if [ "$(ps auxf |grep -v grep |grep $BIN/$SCRIPT |wc -l)" -gt 2 ]; then - check_result $E_EXISTS "another sync process already running" -fi +is_procces_running remote_dns_health_check diff --git a/bin/v-delete-remote-dns-record b/bin/v-delete-remote-dns-record index cbc1d4c8..a4732a2d 100755 --- a/bin/v-delete-remote-dns-record +++ b/bin/v-delete-remote-dns-record @@ -27,12 +27,7 @@ source $VESTA/conf/vesta.conf check_args '3' "$#" 'USER DOMAIN ID' is_format_valid 'user' 'domain' 'id' is_system_enabled "$DNS_CLUSTER" 'DNS_CLUSTER' -if [ ! -e "$VESTA/conf/dns-cluster.conf" ]; then - check_result $E_NOTEXIST "dns-cluster.conf doesn't exist" -fi -if [ "$(ps auxf |grep -v grep |grep $BIN/$SCRIPT |wc -l)" -gt 2 ]; then - check_result $E_EXISTS "another sync process already running" -fi +is_procces_running remote_dns_health_check diff --git a/bin/v-sync-dns-cluster b/bin/v-sync-dns-cluster index 811f1bbe..45be3482 100755 --- a/bin/v-sync-dns-cluster +++ b/bin/v-sync-dns-cluster @@ -22,12 +22,7 @@ source $VESTA/conf/vesta.conf #----------------------------------------------------------# is_system_enabled "$DNS_CLUSTER" 'DNS_CLUSTER' -if [ ! -e "$VESTA/conf/dns-cluster.conf" ]; then - check_result $E_NOTEXIST "dns-cluster.conf doesn't exist" -fi -if [ "$(ps auxf |grep -v grep |grep $BIN/$SCRIPT |wc -l)" -gt 2 ]; then - check_result $E_EXISTS "another sync process already running" -fi +is_procces_running remote_dns_health_check 'no_email' diff --git a/func/remote.sh b/func/remote.sh index 1f2d49d3..895e7b45 100644 --- a/func/remote.sh +++ b/func/remote.sh @@ -1,3 +1,13 @@ +# Check if script already running or not +is_procces_running() { + SCRIPT=$(basename $0) + for pid in $(pidof -x $SCRIPT); do + if [ $pid != $$ ]; then + check_result $E_INUSE "$SCRIPT is already running" + fi + done +} + send_api_cmd() { answer=$(curl -s -k \ --data-urlencode "user=$USER" \