myvesta/bin/v-rebuild-cron-jobs
2017-01-11 16:52:11 +02:00

51 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
# info: rebuild cron jobs
# options: USER [RESTART]
#
# The function rebuilds system cron config file for specified user.
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
# Argument definition
user=$1
restart=$2
# Includes
source $VESTA/func/main.sh
source $VESTA/conf/vesta.conf
#----------------------------------------------------------#
# Verifications #
#----------------------------------------------------------#
check_args '1' "$#" 'USER [RESTART]'
is_format_valid 'user'
is_system_enabled "$CRON_SYSTEM" 'CRON_SYSTEM'
is_object_valid 'user' 'USER' "$user"
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
# Rebuild cron jobs
sync_cron_jobs
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
# Restarting crond
$BIN/v-restart-cron $restart
check_result $? "Cron restart failed" >/dev/null
# Logging
log_event "$OK" "$ARGUMENTS"
exit