mirror of
https://github.com/mitchellkrogza/nginx-ultimate-bad-bot-blocker.git
synced 2025-09-02 18:50:13 +00:00
Merge pull request #123 from itoffshore/alpine
update-ngxblocker: less verbose silent mode
This commit is contained in:
commit
7a43a87455
1 changed files with 9 additions and 7 deletions
|
@ -29,7 +29,7 @@
|
||||||
# Here our script runs, pulls the latest update, reloads nginx and emails you a notification
|
# Here our script runs, pulls the latest update, reloads nginx and emails you a notification
|
||||||
|
|
||||||
EMAIL="me@myemail.com"
|
EMAIL="me@myemail.com"
|
||||||
SEND_EMAIL="Y"
|
SEND_EMAIL="N"
|
||||||
CONF_DIR=/etc/nginx/conf.d
|
CONF_DIR=/etc/nginx/conf.d
|
||||||
BOTS_DIR=/etc/nginx/bots.d
|
BOTS_DIR=/etc/nginx/bots.d
|
||||||
INSTALLER=/usr/sbin/install-ngxblocker
|
INSTALLER=/usr/sbin/install-ngxblocker
|
||||||
|
@ -242,8 +242,8 @@ get_options() {
|
||||||
b) BOTS_DIR=$arg; check_args $opts path $arg ;;
|
b) BOTS_DIR=$arg; check_args $opts path $arg ;;
|
||||||
i) INSTALLER=$arg; check_args $opts script $arg ;;
|
i) INSTALLER=$arg; check_args $opts script $arg ;;
|
||||||
r) REPO=$arg; check_args $opts url $arg ;;
|
r) REPO=$arg; check_args $opts url $arg ;;
|
||||||
e) EMAIL=$arg; check_args $opts email $arg ;;
|
e) EMAIL=$arg; SEND_EMAIL=Y; check_args $opts email $arg ;;
|
||||||
m) EMAIL=$arg ;; # /etc/aliases no sanity checks
|
m) EMAIL=$arg; SEND_EMAIL=Y ;; # /etc/aliases no sanity checks
|
||||||
n) SEND_EMAIL=N ;;
|
n) SEND_EMAIL=N ;;
|
||||||
v) check_version; exit 0 ;;
|
v) check_version; exit 0 ;;
|
||||||
s) export VERBOSE=N ;;
|
s) export VERBOSE=N ;;
|
||||||
|
@ -320,6 +320,11 @@ main() {
|
||||||
else
|
else
|
||||||
printf "\n${BOLDRED}Download failed${RESET}: not reloading NGINX config\n"
|
printf "\n${BOLDRED}Download failed${RESET}: not reloading NGINX config\n"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# in silent mode print a single message after an update
|
||||||
|
if [ "$VERBOSE" = "N" ]; then
|
||||||
|
printf "NGINX Blacklist updated =>$(grep "Version:" $CONF_DIR/globalblacklist.conf | tr -d '#')\n"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
# set custom bots.d path
|
# set custom bots.d path
|
||||||
update_paths $output
|
update_paths $output
|
||||||
|
@ -328,10 +333,7 @@ main() {
|
||||||
# email report
|
# email report
|
||||||
check_mail_depends
|
check_mail_depends
|
||||||
case "$SEND_EMAIL" in
|
case "$SEND_EMAIL" in
|
||||||
y*|Y*) if [ "$VERBOSE" = "N" ]; then
|
y*|Y*) print_message "Emailing report to: ${BOLDWHITE}$EMAIL${RESET}\n\n";
|
||||||
grep "Version:" $CONF_DIR/globalblacklist.conf | tr -d '#'
|
|
||||||
fi
|
|
||||||
print_message "Emailing report to: ${BOLDWHITE}$EMAIL${RESET}\n\n";
|
|
||||||
# remove ansi colour codes
|
# remove ansi colour codes
|
||||||
sed -i 's/\x1b\[[0-9;]*m//g' $EMAIL_REPORT
|
sed -i 's/\x1b\[[0-9;]*m//g' $EMAIL_REPORT
|
||||||
cat $EMAIL_REPORT | mail -s "Nginx Bad Bot Blocker Updated" $EMAIL
|
cat $EMAIL_REPORT | mail -s "Nginx Bad Bot Blocker Updated" $EMAIL
|
||||||
|
|
Loading…
Add table
Reference in a new issue