#!/bin/bash # info: add cron reports # options: USER # # example: v-add-cron-reports admin # # This function for enabling reports on cron tasks and administrative # notifications. #----------------------------------------------------------# # Variables & Functions # #----------------------------------------------------------# # Argument definition user=$1 # Includes # shellcheck source=/etc/hestiacp/hestia.conf source /etc/hestiacp/hestia.conf # shellcheck source=/usr/local/hestia/func/main.sh source $HESTIA/func/main.sh # load config file source_conf "$HESTIA/conf/hestia.conf" #----------------------------------------------------------# # Verifications # #----------------------------------------------------------# check_args '1' "$#" 'USER' is_format_valid 'user' is_system_enabled "$CRON_SYSTEM" 'CRON_SYSTEM' is_object_valid 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user" # Perform verification if read-only mode is enabled check_hestia_demo_mode #----------------------------------------------------------# # Action # #----------------------------------------------------------# # Changing user report value update_user_value "$user" '$CRON_REPORTS' 'yes' # Sync system cron with user sync_cron_jobs #----------------------------------------------------------# # Hestia # #----------------------------------------------------------# # Restart cron $BIN/v-restart-cron check_result $? "Cron restart failed" > /dev/null # Logging $BIN/v-log-action "$user" "Info" "Cron Jobs" "Cron job notifications and reporting enabled." log_event "$OK" "$ARGUMENTS" exit