2013-01-19 23:07:26 +02:00
|
|
|
#!/bin/bash
|
|
|
|
# info: rebuild cron jobs
|
|
|
|
# options: USER [RESTART]
|
|
|
|
#
|
|
|
|
# The function rebuilds system cron config file for specified user.
|
|
|
|
|
|
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
|
|
# Variable&Function #
|
|
|
|
#----------------------------------------------------------#
|
|
|
|
|
2015-11-06 17:38:58 +02:00
|
|
|
# Argument definition
|
2013-01-19 23:07:26 +02:00
|
|
|
user=$1
|
|
|
|
restart=$2
|
|
|
|
|
|
|
|
# Includes
|
|
|
|
source $VESTA/func/main.sh
|
2013-10-09 00:50:08 +03:00
|
|
|
source $VESTA/conf/vesta.conf
|
2013-01-19 23:07:26 +02:00
|
|
|
|
|
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
|
|
# Verifications #
|
|
|
|
#----------------------------------------------------------#
|
|
|
|
|
|
|
|
check_args '1' "$#" 'USER [RESTART]'
|
2016-06-09 16:31:56 +03:00
|
|
|
is_format_valid 'user'
|
2013-05-29 13:16:09 +03:00
|
|
|
is_system_enabled "$CRON_SYSTEM" 'CRON_SYSTEM'
|
2013-01-19 23:07:26 +02:00
|
|
|
is_object_valid 'user' 'USER' "$user"
|
|
|
|
|
|
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
|
|
# Action #
|
|
|
|
#----------------------------------------------------------#
|
|
|
|
|
|
|
|
# Rebuild cron jobs
|
|
|
|
sync_cron_jobs
|
|
|
|
|
|
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
|
|
# Vesta #
|
|
|
|
#----------------------------------------------------------#
|
|
|
|
|
2015-10-28 16:34:41 +02:00
|
|
|
# Restarting crond
|
2017-01-11 16:52:11 +02:00
|
|
|
$BIN/v-restart-cron $restart
|
|
|
|
check_result $? "Cron restart failed" >/dev/null
|
2013-01-19 23:07:26 +02:00
|
|
|
|
|
|
|
# Logging
|
2016-06-09 16:31:56 +03:00
|
|
|
log_event "$OK" "$ARGUMENTS"
|
2013-01-19 23:07:26 +02:00
|
|
|
|
|
|
|
exit
|