mirror of
https://github.com/mitchellkrogza/nginx-ultimate-bad-bot-blocker.git
synced 2025-09-03 11:10:47 +00:00
update-ngxblocker: detect /bin/mail in centos / add -m cmd line switch for mail
* also detect /bin/mail in centos * adds -m command line switch to specify an email address (to avoid confusion with -e used in setup-ngxblocker to specify vhost file extensions) -e can still be used to specify an email address to avoid breakage with current cron jobs
This commit is contained in:
parent
7ae8dbce1c
commit
af197cb559
1 changed files with 5 additions and 4 deletions
|
@ -53,7 +53,7 @@ Usage: $script [OPTIONS]
|
||||||
[ -b ] : NGINX bots directory (default: $BOTS_DIR)
|
[ -b ] : NGINX bots directory (default: $BOTS_DIR)
|
||||||
[ -i ] : Change installer path (default: $INSTALLER)
|
[ -i ] : Change installer path (default: $INSTALLER)
|
||||||
[ -r ] : Change repo url (default: $REPO)
|
[ -r ] : Change repo url (default: $REPO)
|
||||||
[ -e ] : Change email address (default: $EMAIL)
|
[ -m ] : Change email address (default: $EMAIL)
|
||||||
[ -n ] : Do not send email report (default: $SEND_EMAIL)
|
[ -n ] : Do not send email report (default: $SEND_EMAIL)
|
||||||
[ -v ] : Print blacklist version
|
[ -v ] : Print blacklist version
|
||||||
[ -h ] : this help message
|
[ -h ] : this help message
|
||||||
|
@ -194,8 +194,8 @@ check_args() {
|
||||||
}
|
}
|
||||||
|
|
||||||
check_mail_depends() {
|
check_mail_depends() {
|
||||||
if [ ! -f /usr/bin/mail ]; then # mailx + ssmtp are enough to send emails
|
if [ ! -f /usr/bin/mail ] && [ ! -f /bin/mail ]; then # mailx + ssmtp are enough to send emails
|
||||||
printf "${BOLDYELLOW}WARN${RESET}: missing /usr/bin/mail => ${BOLDWHITE}disabling emails${RESET}.\n\n"
|
printf "${BOLDYELLOW}WARN${RESET}: missing mail command => ${BOLDWHITE}disabling emails${RESET}.\n\n"
|
||||||
SEND_EMAIL="N"
|
SEND_EMAIL="N"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -223,7 +223,7 @@ check_depends() {
|
||||||
get_options() {
|
get_options() {
|
||||||
local arg= opts=
|
local arg= opts=
|
||||||
|
|
||||||
while getopts :c:b:u:r:e:nvh opts "$@"
|
while getopts :c:b:u:r:e:m:nvh opts "$@"
|
||||||
do
|
do
|
||||||
if [ -n "${OPTARG}" ]; then
|
if [ -n "${OPTARG}" ]; then
|
||||||
case "$opts" in
|
case "$opts" in
|
||||||
|
@ -239,6 +239,7 @@ get_options() {
|
||||||
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; check_args $opts email $arg ;;
|
||||||
|
m) EMAIL=$arg; check_args $opts email $arg ;;
|
||||||
n) SEND_EMAIL=N ;;
|
n) SEND_EMAIL=N ;;
|
||||||
v) check_depends; check_version ;;
|
v) check_depends; check_version ;;
|
||||||
h) usage ;;
|
h) usage ;;
|
||||||
|
|
Loading…
Add table
Reference in a new issue