mirror of
https://github.com/myvesta/vesta.git
synced 2024-12-21 11:31:21 -08:00
51 lines
1.3 KiB
Bash
Executable File
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
|