mirror of
https://github.com/serghey-rodin/vesta.git
synced 2025-08-20 13:24:24 -07:00
restart cron job
This commit is contained in:
parent
10f7097c48
commit
6365fe984d
5 changed files with 156 additions and 1 deletions
43
bin/v-add-cron-restart-job
Executable file
43
bin/v-add-cron-restart-job
Executable file
|
@ -0,0 +1,43 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: add cron reports
|
||||||
|
# opions: NONE
|
||||||
|
#
|
||||||
|
# The script for enabling restart cron tasks
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Includes
|
||||||
|
source $VESTA/conf/vesta.conf
|
||||||
|
source $VESTA/func/main.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
is_system_enabled "$CRON_SYSTEM" 'CRON_SYSTEM'
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Add cron job
|
||||||
|
cmd="sudo /usr/local/vesta/bin/v-update-sys-queue restart"
|
||||||
|
check_cron=$(grep "$cmd" $VESTA/data/users/admin/cron.conf 2> /dev/null)
|
||||||
|
if [ -z "$check_cron" ] && [ ! -z "$CRON_SYSTEM" ]; then
|
||||||
|
$BIN/v-add-cron-job admin '*' '*' '*' '*' '*' "$cmd"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_event "$OK" "$EVENT"
|
||||||
|
|
||||||
|
exit
|
|
@ -57,6 +57,17 @@ else
|
||||||
sed -i "s/DNS_CLUSTER=.*/DNS_CLUSTER='yes'/g" $VESTA/conf/vesta.conf
|
sed -i "s/DNS_CLUSTER=.*/DNS_CLUSTER='yes'/g" $VESTA/conf/vesta.conf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Enabling restart queue
|
||||||
|
HOST=$host
|
||||||
|
PORT=$port
|
||||||
|
USER=$user
|
||||||
|
PASSWORD=$password
|
||||||
|
case $type in
|
||||||
|
ssh) send_cmd="send_ssh_cmd" ;;
|
||||||
|
*) send_cmd="send_api_cmd" ;;
|
||||||
|
esac
|
||||||
|
$send_cmd v-add-cron-restart-job
|
||||||
|
|
||||||
# Sync current zones
|
# Sync current zones
|
||||||
$BIN/v-sync-dns-cluster $host
|
$BIN/v-sync-dns-cluster $host
|
||||||
return_code=$?
|
return_code=$?
|
||||||
|
@ -64,7 +75,7 @@ if [ "$return_code" -ne 0 ]; then
|
||||||
exit $return_code
|
exit $return_code
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Add cron job
|
# Add dns-cluster cron job
|
||||||
cmd="sudo /usr/local/vesta/bin/v-update-sys-queue dns-cluster"
|
cmd="sudo /usr/local/vesta/bin/v-update-sys-queue dns-cluster"
|
||||||
check_cron=$(grep "$cmd" $VESTA/data/users/admin/cron.conf 2> /dev/null)
|
check_cron=$(grep "$cmd" $VESTA/data/users/admin/cron.conf 2> /dev/null)
|
||||||
if [ -z "$check_cron" ] && [ ! -z "$CRON_SYSTEM" ]; then
|
if [ -z "$check_cron" ] && [ ! -z "$CRON_SYSTEM" ]; then
|
||||||
|
|
44
bin/v-delete-cron-restart-job
Executable file
44
bin/v-delete-cron-restart-job
Executable file
|
@ -0,0 +1,44 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: delete restart job
|
||||||
|
# opions: NONE
|
||||||
|
#
|
||||||
|
# The script for disabling restart cron tasks
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Includes
|
||||||
|
source $VESTA/conf/vesta.conf
|
||||||
|
source $VESTA/func/main.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
is_system_enabled "$CRON_SYSTEM" 'CRON_SYSTEM'
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Add cron job
|
||||||
|
cmd="sudo /usr/local/vesta/bin/v-update-sys-queue restart"
|
||||||
|
check_cron=$(grep "$cmd" $VESTA/data/users/admin/cron.conf 2> /dev/null)
|
||||||
|
if [ ! -z "$check_cron" ]; then
|
||||||
|
eval $check_cron
|
||||||
|
$BIN/v-delete-cron-job admin "$JOB"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_event "$OK" "$EVENT"
|
||||||
|
|
||||||
|
exit
|
|
@ -34,6 +34,14 @@ is_object_valid "../../conf/dns-cluster" 'HOST' "$host"
|
||||||
# Deleting domains
|
# Deleting domains
|
||||||
$BIN/v-delete-remote-dns-domains $host >>/dev/null 2>&1
|
$BIN/v-delete-remote-dns-domains $host >>/dev/null 2>&1
|
||||||
|
|
||||||
|
# Disabling restart queue
|
||||||
|
eval $(grep $host $VESTA/conf/dns-cluster)
|
||||||
|
case $TYPE in
|
||||||
|
ssh) send_cmd="send_ssh_cmd" ;;
|
||||||
|
*) send_cmd="send_api_cmd" ;;
|
||||||
|
esac
|
||||||
|
$send_cmd v-add-cron-restart-job
|
||||||
|
|
||||||
# Deleting server
|
# Deleting server
|
||||||
sed -i "/HOST='$host' /d" $VESTA/conf/dns-cluster.conf
|
sed -i "/HOST='$host' /d" $VESTA/conf/dns-cluster.conf
|
||||||
|
|
||||||
|
|
49
bin/v-list-remote-dsn-hosts
Executable file
49
bin/v-list-remote-dsn-hosts
Executable file
|
@ -0,0 +1,49 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: list remote dns host
|
||||||
|
# options: [FORMAT]
|
||||||
|
#
|
||||||
|
# The function for obtaining the list of remote dns host.
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
format=${1-shell}
|
||||||
|
|
||||||
|
# Includes
|
||||||
|
source $VESTA/func/main.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Check config
|
||||||
|
conf=$VESTA/conf/dns-cluster.conf
|
||||||
|
if [ ! -e "$conf" ]; then
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Defining fileds to select
|
||||||
|
fields='$HOST $USER $DNS_USER $TYPE $TIME $DATE'
|
||||||
|
|
||||||
|
case $format in
|
||||||
|
json) json_list ;;
|
||||||
|
plain) nohead=1; shell_list ;;
|
||||||
|
shell) shell_list| column -t ;;
|
||||||
|
*) check_args '1' '0' 'USER [FORMAT]';;
|
||||||
|
esac
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
exit
|
Loading…
Add table
Add a link
Reference in a new issue