Skip to content

Commit 6365fe9

Browse files
committed
restart cron job
1 parent 10f7097 commit 6365fe9

File tree

5 files changed

+156
-1
lines changed

5 files changed

+156
-1
lines changed

bin/v-add-cron-restart-job

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/bin/bash
2+
# info: add cron reports
3+
# opions: NONE
4+
#
5+
# The script for enabling restart cron tasks
6+
7+
8+
#----------------------------------------------------------#
9+
# Variable&Function #
10+
#----------------------------------------------------------#
11+
12+
# Includes
13+
source $VESTA/conf/vesta.conf
14+
source $VESTA/func/main.sh
15+
16+
17+
#----------------------------------------------------------#
18+
# Verifications #
19+
#----------------------------------------------------------#
20+
21+
is_system_enabled "$CRON_SYSTEM" 'CRON_SYSTEM'
22+
23+
24+
#----------------------------------------------------------#
25+
# Action #
26+
#----------------------------------------------------------#
27+
28+
# Add cron job
29+
cmd="sudo /usr/local/vesta/bin/v-update-sys-queue restart"
30+
check_cron=$(grep "$cmd" $VESTA/data/users/admin/cron.conf 2> /dev/null)
31+
if [ -z "$check_cron" ] && [ ! -z "$CRON_SYSTEM" ]; then
32+
$BIN/v-add-cron-job admin '*' '*' '*' '*' '*' "$cmd"
33+
fi
34+
35+
36+
#----------------------------------------------------------#
37+
# Vesta #
38+
#----------------------------------------------------------#
39+
40+
# Logging
41+
log_event "$OK" "$EVENT"
42+
43+
exit

bin/v-add-remote-dns-host

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,25 @@ else
5757
sed -i "s/DNS_CLUSTER=.*/DNS_CLUSTER='yes'/g" $VESTA/conf/vesta.conf
5858
fi
5959

60+
# Enabling restart queue
61+
HOST=$host
62+
PORT=$port
63+
USER=$user
64+
PASSWORD=$password
65+
case $type in
66+
ssh) send_cmd="send_ssh_cmd" ;;
67+
*) send_cmd="send_api_cmd" ;;
68+
esac
69+
$send_cmd v-add-cron-restart-job
70+
6071
# Sync current zones
6172
$BIN/v-sync-dns-cluster $host
6273
return_code=$?
6374
if [ "$return_code" -ne 0 ]; then
6475
exit $return_code
6576
fi
6677

67-
# Add cron job
78+
# Add dns-cluster cron job
6879
cmd="sudo /usr/local/vesta/bin/v-update-sys-queue dns-cluster"
6980
check_cron=$(grep "$cmd" $VESTA/data/users/admin/cron.conf 2> /dev/null)
7081
if [ -z "$check_cron" ] && [ ! -z "$CRON_SYSTEM" ]; then

bin/v-delete-cron-restart-job

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/bin/bash
2+
# info: delete restart job
3+
# opions: NONE
4+
#
5+
# The script for disabling restart cron tasks
6+
7+
8+
#----------------------------------------------------------#
9+
# Variable&Function #
10+
#----------------------------------------------------------#
11+
12+
# Includes
13+
source $VESTA/conf/vesta.conf
14+
source $VESTA/func/main.sh
15+
16+
17+
#----------------------------------------------------------#
18+
# Verifications #
19+
#----------------------------------------------------------#
20+
21+
is_system_enabled "$CRON_SYSTEM" 'CRON_SYSTEM'
22+
23+
24+
#----------------------------------------------------------#
25+
# Action #
26+
#----------------------------------------------------------#
27+
28+
# Add cron job
29+
cmd="sudo /usr/local/vesta/bin/v-update-sys-queue restart"
30+
check_cron=$(grep "$cmd" $VESTA/data/users/admin/cron.conf 2> /dev/null)
31+
if [ ! -z "$check_cron" ]; then
32+
eval $check_cron
33+
$BIN/v-delete-cron-job admin "$JOB"
34+
fi
35+
36+
37+
#----------------------------------------------------------#
38+
# Vesta #
39+
#----------------------------------------------------------#
40+
41+
# Logging
42+
log_event "$OK" "$EVENT"
43+
44+
exit

bin/v-delete-remote-dns-host

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@ is_object_valid "../../conf/dns-cluster" 'HOST' "$host"
3434
# Deleting domains
3535
$BIN/v-delete-remote-dns-domains $host >>/dev/null 2>&1
3636

37+
# Disabling restart queue
38+
eval $(grep $host $VESTA/conf/dns-cluster)
39+
case $TYPE in
40+
ssh) send_cmd="send_ssh_cmd" ;;
41+
*) send_cmd="send_api_cmd" ;;
42+
esac
43+
$send_cmd v-add-cron-restart-job
44+
3745
# Deleting server
3846
sed -i "/HOST='$host' /d" $VESTA/conf/dns-cluster.conf
3947

bin/v-list-remote-dsn-hosts

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#!/bin/bash
2+
# info: list remote dns host
3+
# options: [FORMAT]
4+
#
5+
# The function for obtaining the list of remote dns host.
6+
7+
8+
#----------------------------------------------------------#
9+
# Variable&Function #
10+
#----------------------------------------------------------#
11+
12+
# Argument defenition
13+
format=${1-shell}
14+
15+
# Includes
16+
source $VESTA/func/main.sh
17+
18+
19+
#----------------------------------------------------------#
20+
# Verifications #
21+
#----------------------------------------------------------#
22+
23+
24+
#----------------------------------------------------------#
25+
# Action #
26+
#----------------------------------------------------------#
27+
28+
# Check config
29+
conf=$VESTA/conf/dns-cluster.conf
30+
if [ ! -e "$conf" ]; then
31+
exit
32+
fi
33+
34+
# Defining fileds to select
35+
fields='$HOST $USER $DNS_USER $TYPE $TIME $DATE'
36+
37+
case $format in
38+
json) json_list ;;
39+
plain) nohead=1; shell_list ;;
40+
shell) shell_list| column -t ;;
41+
*) check_args '1' '0' 'USER [FORMAT]';;
42+
esac
43+
44+
45+
#----------------------------------------------------------#
46+
# Vesta #
47+
#----------------------------------------------------------#
48+
49+
exit

0 commit comments

Comments
 (0)