You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
hestiacp/bin/v-delete-cron-reports

61 lines
1.7 KiB

#!/bin/bash
# info: delete cron reports
# options: USER
#
# example: v-delete-cron-reports admin
#
# This function for disabling 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' 'no'
# Sync system cron with user
sync_cron_jobs
#----------------------------------------------------------#
# Hestia #
#----------------------------------------------------------#
# Restarting cron
$BIN/v-restart-cron
check_result $? "Cron restart failed" > /dev/null
# Logging
$BIN/v-log-action "$user" "Info" "Warning" "Cron job notifications and reporting disabled."
log_event "$OK" "$ARGUMENTS"
exit