Initial
This commit is contained in:
60
bin/v-delete-cron-reports
Executable file
60
bin/v-delete-cron-reports
Executable file
@@ -0,0 +1,60 @@
|
||||
#!/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
|
||||
Reference in New Issue
Block a user