Initial
This commit is contained in:
45
bin/v-delete-sys-mail-queue
Executable file
45
bin/v-delete-sys-mail-queue
Executable file
@@ -0,0 +1,45 @@
|
||||
#!/bin/bash
|
||||
# info: delete exim mail queue
|
||||
# options: none
|
||||
#
|
||||
# example: v-delete-sys-mail-queue
|
||||
#
|
||||
# This function checks for messages stuck in the exim mail queue
|
||||
# and prompts the user to clear the queue if desired.
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Variables & Functions #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# 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"
|
||||
|
||||
# Perform verification if read-only mode is enabled
|
||||
check_hestia_demo_mode
|
||||
|
||||
message_count=$(exim -bpc)
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Action #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
if [ "$message_count" -gt 0 ]; then
|
||||
read -p "Are you sure you want to delete $message_count messages from the exim queue? [y/N] " answer
|
||||
|
||||
if [ "$answer" = "y" ] || [ "$answer" = "Y" ]; then
|
||||
exiqgrep -i | xargs exim -Mrm
|
||||
fi
|
||||
fi
|
||||
#----------------------------------------------------------#
|
||||
# Hestia #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
$BIN/v-log-action "system" "Info" "System" "Mail queue ($message_count) has been deleted"
|
||||
log_event "$OK" "$ARGUMENTS"
|
||||
|
||||
exit
|
||||
Reference in New Issue
Block a user