From 8a2007ec80003fd0011daa8dc07e87e4a447bf25 Mon Sep 17 00:00:00 2001 From: Alfonso Date: Sun, 19 Apr 2020 23:38:49 +0200 Subject: [PATCH] Ask for mail Now the script asks to user for an email to send the log file. Timeout of 15 seconds. That is for cron purposes. If the timeout ocurrs, the default address will be ($whoami)@$HOSTNAME --- blocklist-update.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/blocklist-update.sh b/blocklist-update.sh index 94e76bd..934aa2b 100644 --- a/blocklist-update.sh +++ b/blocklist-update.sh @@ -24,7 +24,8 @@ if [ ! -f $GREP_PATH ]; then echo "Cannot find [ grep ]. Is it installed? Exitin MAILLOG="/var/log/blocklist-update.log" MAIL_SENDER=$(whoami) #this defines a system-user without a shell or password. It's used as the e-mail sender name. You can create one like this: useradd -M -N -s /usr/sbin/nologin myuser && passwd -d myuser MAIL_SUBJECT="ERROR - IP blocklist script failed to download the IP set" -MAIL_RECIPIENTS="mail-recipient@yourdomain.tld" #send mail to multiple receipients by overgiving a space-seperated address list +read -t 15 -p "Insert a mail to send the log. Separate with space to send to multiple recipients: " MAIL_RECIPIENTS +if [ ! $MAIL_RECIPIENTS ]; then MAIL_RECIPIENTS="$(whoami)@$(HOSTNAME)"; else echo "Address: " $MAIL_RECIPIENTS; fi; BLOCKLIST_FILE="/tmp/ip-blocklist.txt" BLOCKLIST_TMP_FILE="/tmp/ip-blocklist.txt.tmp"