restart cron job

This commit is contained in:
Serghey Rodin 2013-06-01 15:51:19 +03:00
commit 6365fe984d
5 changed files with 156 additions and 1 deletions

43
bin/v-add-cron-restart-job Executable file
View 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

View file

@ -57,6 +57,17 @@ else
sed -i "s/DNS_CLUSTER=.*/DNS_CLUSTER='yes'/g" $VESTA/conf/vesta.conf
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
$BIN/v-sync-dns-cluster $host
return_code=$?
@ -64,7 +75,7 @@ if [ "$return_code" -ne 0 ]; then
exit $return_code
fi
# Add cron job
# Add dns-cluster cron job
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)
if [ -z "$check_cron" ] && [ ! -z "$CRON_SYSTEM" ]; then

44
bin/v-delete-cron-restart-job Executable file
View 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

View file

@ -34,6 +34,14 @@ is_object_valid "../../conf/dns-cluster" 'HOST' "$host"
# Deleting domains
$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
sed -i "/HOST='$host' /d" $VESTA/conf/dns-cluster.conf

49
bin/v-list-remote-dsn-hosts Executable file
View 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