Skip to content

Commit 22ab6d5

Browse files
committed
added sys-queue handler
1 parent 7ebd96d commit 22ab6d5

File tree

4 files changed

+32
-11
lines changed

4 files changed

+32
-11
lines changed

bin/v-add-remote-dns-host

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,20 @@ else
5858
fi
5959

6060
# Sync current zones
61-
$BIN/v-sync-dns-cluster
61+
$BIN/v-sync-dns-cluster $host
6262
return_code=$?
6363
if [ "$return_code" -ne 0 ]; then
6464
exit $return_code
6565
fi
6666

67+
# Add cron job
68+
cmd="sudo /usr/local/vesta/bin/v-update-sys-queue dns-cluster"
69+
check_cron=$(grep "$cmd" $VESTA/data/users/admin/cron.conf 2> /dev/null)
70+
if [ -z "$check_cron" ] && [ ! -z "$CRON_SYSTEM" ]; then
71+
$BIN/v-add-cron-job admin '*/5' '*' '*' '*' '*' "$cmd"
72+
fi
73+
74+
6775
#----------------------------------------------------------#
6876
# Vesta #
6977
#----------------------------------------------------------#

bin/v-delete-remote-dns-host

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,19 @@ $BIN/v-delete-remote-dns-domains $host >>/dev/null 2>&1
3737
# Deleting server
3838
sed -i "/HOST='$host' /d" $VESTA/conf/dns-cluster.conf
3939

40-
# Disabling DNS_CLUSTER
40+
# Delete DNS_CLUSTER key
4141
check_cluster=$(grep HOST $VESTA/conf/dns-cluster.conf |wc -l)
4242
if [ "$check_cluster" -eq '0' ]; then
4343
rm -f $VESTA/conf/dns-cluster.conf
4444
sed -i "/DNS_CLUSTER=/d" $VESTA/conf/vesta.conf
45+
46+
# Delete cron job
47+
cmd="sudo /usr/local/vesta/bin/v-update-sys-queue dns-cluster"
48+
check_cron=$(grep "$cmd" $VESTA/data/users/admin/cron.conf 2> /dev/null)
49+
if [ ! -z "$check_cron" ]; then
50+
eval $check_cron
51+
$BIN/v-delete-cron-job admin "$JOB"
52+
fi
4553
fi
4654

4755

bin/v-sync-dns-cluster

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22
# info: synchronize dns domains
3-
#
3+
# options: HOST
44
# The function synchronize all dns domains.
55

66

@@ -9,7 +9,8 @@
99
#----------------------------------------------------------#
1010

1111
# Argument defenition
12-
verbose=$1
12+
host=$1
13+
verbose=$2
1314

1415
# Includes
1516
source $VESTA/conf/vesta.conf
@@ -44,8 +45,17 @@ fi
4445
old_ifs="$IFS"
4546
IFS=$'\n'
4647

48+
if [ -z $host ]; then
49+
hosts=$(cat $VESTA/conf/dns-cluster.conf)
50+
rm -f $VESTA/data/queue/dns-cluster.pipe
51+
touch $VESTA/data/queue/dns-cluster.pipe
52+
chmod 660 $VESTA/data/queue/dns-cluster.pipe
53+
else
54+
hosts=$(grep "HOST='$host'" $VESTA/conf/dns-cluster.conf)
55+
fi
56+
4757
# Starting cluster loop
48-
for cluster_str in $(cat $VESTA/conf/dns-cluster.conf); do
58+
for cluster_str in $hosts; do
4959

5060
# Get host values
5161
eval $cluster_str
@@ -108,11 +118,6 @@ for cluster_str in $(cat $VESTA/conf/dns-cluster.conf); do
108118
exit $E_CONNECT
109119
fi
110120

111-
# Clean queue
112-
rm -f $VESTA/data/queue/dns-cluster.pipe
113-
touch $VESTA/data/queue/dns-cluster.pipe
114-
chmod 660 $VESTA/data/queue/dns-cluster.pipe
115-
116121
# Start user loop
117122
for user in $user_list; do
118123

bin/v-update-sys-queue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ case $queue in
5353
backup) bash $VESTA/data/queue/$queue.pipe > /dev/null 2>&1 ;;
5454
disk) bash $VESTA/data/queue/$queue.pipe ;;
5555
traffic) bash $VESTA/data/queue/$queue.pipe ;;
56-
dns-cluster) bash $VESTA/data/queue/$queue.pipe ;;
56+
dns-cluster) bash $VESTA/data/queue/$queue.pipe > /dev/null 2>&1 ;;
5757
*) check_args '1' '0' 'QUEUE' ;;
5858
esac
5959

0 commit comments

Comments
 (0)