myvesta/bin/v-rebuild-cron-jobs
2015-10-28 16:34:41 +02:00

53 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 defenition
user=$1
restart=$2
# Includes
source $VESTA/func/main.sh
source $VESTA/conf/vesta.conf
#----------------------------------------------------------#
# Verifications #
#----------------------------------------------------------#
check_args '1' "$#" 'USER [RESTART]'
validate_format 'user'
is_system_enabled "$CRON_SYSTEM" 'CRON_SYSTEM'
is_object_valid 'user' 'USER' "$user"
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
# Rebuild cron jobs
sync_cron_jobs
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
# Restarting crond
if [ "$restart" != 'no' ]; then
$BIN/v-restart-cron
check_result $? "Cron restart failed" >/dev/null
fi
# Logging
log_event "$OK" "$EVENT"
exit